summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--website/posts/guixsd-system-tests.sxml4
-rw-r--r--website/posts/service-composition-in-guixsd.sxml8
2 files changed, 6 insertions, 6 deletions
diff --git a/website/posts/guixsd-system-tests.sxml b/website/posts/guixsd-system-tests.sxml
index bed3854..a197870 100644
--- a/website/posts/guixsd-system-tests.sxml
+++ b/website/posts/guixsd-system-tests.sxml
@@ -99,8 +99,8 @@
"‘uname’")
" system call returns something that matches the OS declaration looks like this:"
(br))
- (div (@ (class "example"))
- (pre "(define (run-test)\n (define os\n ;; The declaration of the OS we want to instantiate and test.\n ;; Calling 'marionette-operating-system' instruments it.\n (marionette-operating-system\n (operating-system\n (host-name \"komputilo\")\n (timezone \"Europe/Berlin\")\n (locale \"en_US.UTF-8\")\n\n (bootloader (grub-configuration (device \"/dev/sdX\")))\n (file-systems %base-file-systems))))\n\n ;; Compute the script to run OS in a VM.\n (mlet %store-monad ((run (system-qemu-image/shared-store-script\n os #:graphic? #f)))\n (define test\n ;; The actual test. Here “#~” is like “quote”, allowing us\n ;; to describe code to run in the build environment; it’s a\n ;; “g-expression.”\n #~(begin\n (use-modules (gnu build marionette)\n (srfi srfi-64)\n (ice-9 match))\n\n (define marionette\n\t ;; Spawn the VM that runs the declared OS.\n (make-marionette (list #$run)))\n\n (mkdir #$output)\n (chdir #$output)\n\n (test-begin \"basic\")\n\n (test-assert \"uname\"\n\t ;; Call the ‘uname’ Scheme function in the guest.\n\t ;; In the host, make sure its result (a vector) matches\n\t ;; our OS declaration above.\n (match (marionette-eval '(uname) marionette)\n (#(\"Linux\" host-name version _ architecture)\n (and (string=? host-name\n #$(operating-system-host-name os))\n (string-prefix? #$(package-version\n (operating-system-kernel os))\n version)\n (string-prefix? architecture %host-type)))))\n\n (test-end)\n (exit (= (test-runner-fail-count (test-runner-current)) 0))))\n\n ;; Turn the test into a buildable “derivation”.\n (gexp->derivation \"simple-test\" test\n #:modules '((gnu build marionette)))))\n"))
+ (pre (code (@ (class "language-scheme"))
+ "(define (run-test)\n (define os\n ;; The declaration of the OS we want to instantiate and test.\n ;; Calling 'marionette-operating-system' instruments it.\n (marionette-operating-system\n (operating-system\n (host-name \"komputilo\")\n (timezone \"Europe/Berlin\")\n (locale \"en_US.UTF-8\")\n\n (bootloader (grub-configuration (device \"/dev/sdX\")))\n (file-systems %base-file-systems))))\n\n ;; Compute the script to run OS in a VM.\n (mlet %store-monad ((run (system-qemu-image/shared-store-script\n os #:graphic? #f)))\n (define test\n ;; The actual test. Here “#~” is like “quote”, allowing us\n ;; to describe code to run in the build environment; it’s a\n ;; “g-expression.”\n #~(begin\n (use-modules (gnu build marionette)\n (srfi srfi-64)\n (ice-9 match))\n\n (define marionette\n\t ;; Spawn the VM that runs the declared OS.\n (make-marionette (list #$run)))\n\n (mkdir #$output)\n (chdir #$output)\n\n (test-begin \"basic\")\n\n (test-assert \"uname\"\n\t ;; Call the ‘uname’ Scheme function in the guest.\n\t ;; In the host, make sure its result (a vector) matches\n\t ;; our OS declaration above.\n (match (marionette-eval '(uname) marionette)\n (#(\"Linux\" host-name version _ architecture)\n (and (string=? host-name\n #$(operating-system-host-name os))\n (string-prefix? #$(package-version\n (operating-system-kernel os))\n version)\n (string-prefix? architecture %host-type)))))\n\n (test-end)\n (exit (= (test-runner-fail-count (test-runner-current)) 0))))\n\n ;; Turn the test into a buildable “derivation”.\n (gexp->derivation \"simple-test\" test\n #:modules '((gnu build marionette)))))\n"))
(p "There are interesting things going on here. First, while this is all Scheme code, there are in fact three tiers or strata of code at play here: the code that produces the OS declaration and the derivation, the build code of that derivation—the test—embodied in a "
(a (@ (href "https://www.gnu.org/software/guix/manual/html_node/G_002dExpressions.html"))
"g-expression")
diff --git a/website/posts/service-composition-in-guixsd.sxml b/website/posts/service-composition-in-guixsd.sxml
index 349a396..499432a 100644
--- a/website/posts/service-composition-in-guixsd.sxml
+++ b/website/posts/service-composition-in-guixsd.sxml
@@ -101,12 +101,12 @@
(br))
(p "The API makes it easy to see how services contributed to a specific service’s configuration. For instance, the following expression shows the PAM service as extended by other declared services:"
(br))
- (div (@ (class "example"))
- (pre "(fold-services (operating-system-services os) \n #:target-type pam-root-service-type)\n"))
+ (pre (code (@ (class "language-scheme"))
+ "(fold-services (operating-system-services os) \n #:target-type pam-root-service-type)\n"))
(p "The result is a service object whose value is a list of pam-service objects. Likewise, the following expression returns the /etc service, whose value is a list of entries to be added to /etc:"
(br))
- (div (@ (class "example"))
- (pre "(fold-services (operating-system-services os) \n #:target-type etc-service-type)\n"))
+ (pre (code (@ (class "language-scheme"))
+ "(fold-services (operating-system-services os) \n #:target-type etc-service-type)\n"))
(p "This contrasts with the approach taken by "
(a (@ (href "http://nixos.org/")) "NixOS")
", GuixSD’s cousin, and described in this "