summaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-11-15 18:39:18 +0100
committerLudovic Courtès <ludo@gnu.org>2018-11-18 23:37:44 +0100
commite34ae75dc14acb97f661a2787a3c626d7ce65b24 (patch)
tree54735b47e5ba6745355e26359ad4e4b7e36454b5 /gnu/system
parenta7ef45d9de8c6b0d584769404c8754cd3da8fe29 (diff)
linux-initrd: Return file-like objects instead of monadic values.
This is an incompatible change visible to users via the 'initrd' field of 'operating-system'. However, assuming the user's 'initrd' value tail-calls to 'raw-initrd' or 'base-initrd', the switch to non-monadic style is invisible. * gnu/system/linux-initrd.scm (expression->initrd): Use 'computed-file' instead of 'gexp->derivation'. (raw-initrd, base-initrd): Adjust docstring to mention non-monadic return. * gnu/system/vm.scm (expression->derivation-in-linux-vm): Adjust accordingly. * gnu/system.scm (operating-system-directory-base-entries) (operating-system-initrd-file) (operating-system-boot-parameters): Adjust accordingly. * doc/guix.texi (operating-system Reference) (Initial RAM Disk): Update.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/linux-initrd.scm13
-rw-r--r--gnu/system/vm.scm14
2 files changed, 12 insertions, 15 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index a5a111908fd..a53d3cb106c 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -20,8 +20,6 @@
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 21
22(define-module (gnu system linux-initrd) 22(define-module (gnu system linux-initrd)
23 #:use-module (guix monads)
24 #:use-module (guix store)
25 #:use-module (guix gexp) 23 #:use-module (guix gexp)
26 #:use-module (guix utils) 24 #:use-module (guix utils)
27 #:use-module ((guix store) 25 #:use-module ((guix store)
@@ -63,7 +61,7 @@
63 (gzip gzip) 61 (gzip gzip)
64 (name "guile-initrd") 62 (name "guile-initrd")
65 (system (%current-system))) 63 (system (%current-system)))
66 "Return a derivation that builds a Linux initrd (a gzipped cpio archive) 64 "Return as a file-like object a Linux initrd (a gzipped cpio archive)
67containing GUILE and that evaluates EXP, a G-expression, upon booting. All 65containing GUILE and that evaluates EXP, a G-expression, upon booting. All
68the derivations referenced by EXP are automatically copied to the initrd." 66the derivations referenced by EXP are automatically copied to the initrd."
69 67
@@ -100,8 +98,9 @@ the derivations referenced by EXP are automatically copied to the initrd."
100 #:references-graphs '("closure") 98 #:references-graphs '("closure")
101 #:gzip (string-append #$gzip "/bin/gzip"))))) 99 #:gzip (string-append #$gzip "/bin/gzip")))))
102 100
103 (gexp->derivation name builder 101 (computed-file name builder
104 #:references-graphs `(("closure" ,init)))) 102 #:options
103 `(#:references-graphs (("closure" ,init)))))
105 104
106(define (flat-linux-module-directory linux modules) 105(define (flat-linux-module-directory linux modules)
107 "Return a flat directory containing the Linux kernel modules listed in 106 "Return a flat directory containing the Linux kernel modules listed in
@@ -143,7 +142,7 @@ MODULES and taken from LINUX."
143 qemu-networking? 142 qemu-networking?
144 volatile-root? 143 volatile-root?
145 (on-error 'debug)) 144 (on-error 'debug))
146 "Return a monadic derivation that builds a raw initrd, with kernel 145 "Return as a file-like object a raw initrd, with kernel
147modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be 146modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
148mounted by the initrd, possibly in addition to the root file system specified 147mounted by the initrd, possibly in addition to the root file system specified
149on the kernel command line via '--root'. LINUX-MODULES is a list of kernel 148on the kernel command line via '--root'. LINUX-MODULES is a list of kernel
@@ -294,7 +293,7 @@ FILE-SYSTEMS."
294 volatile-root? 293 volatile-root?
295 (extra-modules '()) ;deprecated 294 (extra-modules '()) ;deprecated
296 (on-error 'debug)) 295 (on-error 'debug))
297 "Return a monadic derivation that builds a generic initrd, with kernel 296 "Return as a file-like object a generic initrd, with kernel
298modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be 297modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
299mounted by the initrd, possibly in addition to the root file system specified 298mounted by the initrd, possibly in addition to the root file system specified
300on the kernel command line via '--root'. MAPPED-DEVICES is a list of device 299on the kernel command line via '--root'. MAPPED-DEVICES is a list of device
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index d43b71cbafc..6064e0f899e 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -189,14 +189,12 @@ made available under the /xchg CIFS share."
189 #~(when (zero? (system* #$user-builder)) 189 #~(when (zero? (system* #$user-builder))
190 (reboot)))) 190 (reboot))))
191 191
192 (mlet* %store-monad 192 (let ((initrd (or initrd
193 ((initrd (if initrd ; use the default initrd? 193 (base-initrd file-systems
194 (return initrd) 194 #:on-error 'backtrace
195 (base-initrd file-systems 195 #:linux linux
196 #:on-error 'backtrace 196 #:linux-modules %base-initrd-modules
197 #:linux linux 197 #:qemu-networking? #t))))
198 #:linux-modules %base-initrd-modules
199 #:qemu-networking? #t))))
200 198
201 (define builder 199 (define builder
202 ;; Code that launches the VM that evaluates EXP. 200 ;; Code that launches the VM that evaluates EXP.