From: "Ludovic Courtès" <ludo@gnu.org>
To: 33405@debbugs.gnu.org
Subject: [bug#33405] [PATCH 03/10] linux-initrd: Return file-like objects instead of monadic values.
Date: Fri, 16 Nov 2018 10:36:17 +0100 [thread overview]
Message-ID: <20181116093624.4820-3-ludo@gnu.org> (raw)
In-Reply-To: <20181116093624.4820-1-ludo@gnu.org>
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.
---
doc/guix.texi | 14 +++++++-------
gnu/system.scm | 18 +++++++++---------
gnu/system/linux-initrd.scm | 13 ++++++-------
gnu/system/vm.scm | 14 ++++++--------
4 files changed, 28 insertions(+), 31 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index cf3e95eb9f..439bbd7ef5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9860,7 +9860,7 @@ The list of Linux kernel modules that need to be available in the
initial RAM disk. @xref{Initial RAM Disk}.
@item @code{initrd} (default: @code{base-initrd})
-A monadic procedure that returns an initial RAM disk for the Linux
+A procedure that returns an initial RAM disk for the Linux
kernel. This field is provided to support low-level customization and
should rarely be needed for casual use. @xref{Initial RAM Disk}.
@@ -21917,10 +21917,10 @@ here is how to use it and customize it further.
@cindex initrd
@cindex initial RAM disk
-@deffn {Monadic Procedure} raw-initrd @var{file-systems} @
+@deffn {Scheme Procedure} raw-initrd @var{file-systems} @
[#:linux-modules '()] [#:mapped-devices '()] @
[#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f]
-Return a monadic derivation that builds a raw initrd. @var{file-systems} is
+Return a derivation that builds a raw initrd. @var{file-systems} is
a list of file systems to be mounted by the initrd, possibly in addition to
the root file system specified on the kernel command line via @code{--root}.
@var{linux-modules} is a list of kernel modules to be loaded at boot time.
@@ -21938,10 +21938,10 @@ When @var{volatile-root?} is true, the root file system is writable but any chan
to it are lost.
@end deffn
-@deffn {Monadic Procedure} base-initrd @var{file-systems} @
+@deffn {Scheme Procedure} base-initrd @var{file-systems} @
[#:mapped-devices '()] [#:qemu-networking? #f] [#:volatile-root? #f]@
[#:linux-modules '()]
-Return a monadic derivation that builds a generic initrd, with kernel
+Return as a file-like object a generic initrd, with kernel
modules taken from @var{linux}. @var{file-systems} is a list of file-systems to be
mounted by the initrd, possibly in addition to the root file system specified
on the kernel command line via @code{--root}. @var{mapped-devices} is a list of device
@@ -21961,9 +21961,9 @@ program. That gives a lot of flexibility. The
@code{expression->initrd} procedure builds such an initrd, given the
program to run in that initrd.
-@deffn {Monadic Procedure} expression->initrd @var{exp} @
+@deffn {Scheme Procedure} expression->initrd @var{exp} @
[#:guile %guile-static-stripped] [#:name "guile-initrd"]
-Return a derivation that builds a Linux initrd (a gzipped cpio archive)
+Return as a file-like object a Linux initrd (a gzipped cpio archive)
containing @var{guile} and that evaluates @var{exp}, a G-expression,
upon booting. All the derivations referenced by @var{exp} are
automatically copied to the initrd.
diff --git a/gnu/system.scm b/gnu/system.scm
index b218efc875..4ea9391c4a 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -154,7 +154,7 @@
(default '())) ; list of gexps/strings
(bootloader operating-system-bootloader) ; <bootloader-configuration>
- (initrd operating-system-initrd ; (list fs) -> M derivation
+ (initrd operating-system-initrd ; (list fs) -> file-like
(default base-initrd))
(initrd-modules operating-system-initrd-modules ; list of strings
(thunked) ; it's system-dependent
@@ -442,7 +442,7 @@ value of the SYSTEM-SERVICE-TYPE service."
(return `(("locale" ,locale)))
(mlet %store-monad
((kernel -> (operating-system-kernel os))
- (initrd (operating-system-initrd-file os))
+ (initrd -> (operating-system-initrd-file os))
(params (operating-system-boot-parameters-file os)))
(return `(("kernel" ,kernel)
("parameters" ,params)
@@ -870,12 +870,12 @@ hardware-related operations as necessary when booting a Linux container."
(define make-initrd
(operating-system-initrd os))
- (mlet %store-monad ((initrd (make-initrd boot-file-systems
- #:linux (operating-system-kernel os)
- #:linux-modules
- (operating-system-initrd-modules os)
- #:mapped-devices mapped-devices)))
- (return (file-append initrd "/initrd"))))
+ (let ((initrd (make-initrd boot-file-systems
+ #:linux (operating-system-kernel os)
+ #:linux-modules
+ (operating-system-initrd-modules os)
+ #:mapped-devices mapped-devices)))
+ (file-append initrd "/initrd")))
(define (locale-name->definition* name)
"Variant of 'locale-name->definition' that raises an error upon failure."
@@ -957,7 +957,7 @@ listed in OS. The C library expects to find it under
parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
such as '--root' and '--load' to <boot-parameters>."
(mlet* %store-monad
- ((initrd (operating-system-initrd-file os))
+ ((initrd -> (operating-system-initrd-file os))
(store -> (operating-system-store-file-system os))
(bootloader -> (bootloader-configuration-bootloader
(operating-system-bootloader os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index a5a111908f..a53d3cb106 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -20,8 +20,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu system linux-initrd)
- #:use-module (guix monads)
- #:use-module (guix store)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module ((guix store)
@@ -63,7 +61,7 @@
(gzip gzip)
(name "guile-initrd")
(system (%current-system)))
- "Return a derivation that builds a Linux initrd (a gzipped cpio archive)
+ "Return as a file-like object a Linux initrd (a gzipped cpio archive)
containing GUILE and that evaluates EXP, a G-expression, upon booting. All
the derivations referenced by EXP are automatically copied to the initrd."
@@ -100,8 +98,9 @@ the derivations referenced by EXP are automatically copied to the initrd."
#:references-graphs '("closure")
#:gzip (string-append #$gzip "/bin/gzip")))))
- (gexp->derivation name builder
- #:references-graphs `(("closure" ,init))))
+ (computed-file name builder
+ #:options
+ `(#:references-graphs (("closure" ,init)))))
(define (flat-linux-module-directory linux modules)
"Return a flat directory containing the Linux kernel modules listed in
@@ -143,7 +142,7 @@ MODULES and taken from LINUX."
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return a monadic derivation that builds a raw initrd, with kernel
+ "Return as a file-like object a raw initrd, with kernel
modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
mounted by the initrd, possibly in addition to the root file system specified
on the kernel command line via '--root'. LINUX-MODULES is a list of kernel
@@ -294,7 +293,7 @@ FILE-SYSTEMS."
volatile-root?
(extra-modules '()) ;deprecated
(on-error 'debug))
- "Return a monadic derivation that builds a generic initrd, with kernel
+ "Return as a file-like object a generic initrd, with kernel
modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
mounted by the initrd, possibly in addition to the root file system specified
on 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 d43b71cbaf..6064e0f899 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -189,14 +189,12 @@ made available under the /xchg CIFS share."
#~(when (zero? (system* #$user-builder))
(reboot))))
- (mlet* %store-monad
- ((initrd (if initrd ; use the default initrd?
- (return initrd)
- (base-initrd file-systems
- #:on-error 'backtrace
- #:linux linux
- #:linux-modules %base-initrd-modules
- #:qemu-networking? #t))))
+ (let ((initrd (or initrd
+ (base-initrd file-systems
+ #:on-error 'backtrace
+ #:linux linux
+ #:linux-modules %base-initrd-modules
+ #:qemu-networking? #t))))
(define builder
;; Code that launches the VM that evaluates EXP.
--
2.19.1
next prev parent reply other threads:[~2018-11-16 9:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 9:21 [bug#33405] [PATCH 00/10] De-monadify and clean up system code Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 01/10] bootloader: De-monadify configuration file generators Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 02/10] system: Simplify kernel argument handling Ludovic Courtès
2018-11-16 9:36 ` Ludovic Courtès [this message]
2018-11-16 9:36 ` [bug#33405] [PATCH 04/10] system: De-monadify 'operating-system-boot-parameters' Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 05/10] system: Please Emacs Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 06/10] system: De-monadify 'operating-system-bootcfg' Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 07/10] vm: Remove explicit calls to 'operating-system-derivation' Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 08/10] guix system: Simplify bootloader package handling Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 09/10] guix system: De-monadify bootloader installation script Ludovic Courtès
2018-11-16 9:36 ` [bug#33405] [PATCH 10/10] guix system: Clarify 'perform-action' Ludovic Courtès
2018-11-16 13:39 ` [bug#33405] [PATCH 00/10] De-monadify and clean up system code Mathieu Othacehe
2018-11-16 16:50 ` Ludovic Courtès
2018-11-17 1:14 ` Mathieu Othacehe
2018-11-18 22:42 ` bug#33405: " Ludovic Courtès
2018-11-16 23:32 ` [bug#33405] " Danny Milosavljevic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181116093624.4820-3-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=33405@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).