summaryrefslogtreecommitdiff
path: root/guix/monads.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-09 21:32:36 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-10 00:24:02 +0100
commit033adfe7e0ed37f42098772549414a1dc797605c (patch)
tree45f9f9a50dc3af97f8b5b0a4c4a51303cc28a047 /guix/monads.scm
parent593c3fe600a5f5e90a6eea3a175f83d3319b4efe (diff)
downloadgnu-guix-033adfe7e0ed37f42098772549414a1dc797605c.tar
gnu-guix-033adfe7e0ed37f42098772549414a1dc797605c.tar.gz
gnu: Add (gnu system).
* gnu/system/vm.scm (lower-inputs): Move to monads.scm. (qemu-image): Don't add GRUB-CONFIGURATION to the INPUTS-TO-COPY. (union, file-union, etc-directory): Move to gnu/system.scm. (%demo-operating-system): New variable. (system-qemu-image): Add 'os' parameter. Rewrite in terms of 'operating-system-derivation'. * guix/monads.scm (lower-inputs): New procedure. * gnu/system/grub.scm (grub-configuration-file): Change 'entries' to be a plain list instead of a list of monadic values. * gnu/system.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it.
Diffstat (limited to 'guix/monads.scm')
-rw-r--r--guix/monads.scm19
1 files changed, 18 insertions, 1 deletions
diff --git a/guix/monads.scm b/guix/monads.scm
index f5c9e8e9c7..410fdbecb2 100644
--- a/guix/monads.scm
+++ b/guix/monads.scm
@@ -56,7 +56,8 @@
package-file
package->derivation
built-derivations
- derivation-expression))
+ derivation-expression
+ lower-inputs))
;;; Commentary:
;;;
@@ -319,6 +320,22 @@ OUTPUT directory of PACKAGE."
(string-append out "/" file)
out))))
+(define (lower-inputs inputs)
+ "Turn any package from INPUTS into a derivation; return the corresponding
+input list as a monadic value."
+ ;; XXX: Should probably be in (guix packages).
+ (with-monad %store-monad
+ (sequence %store-monad
+ (map (match-lambda
+ ((name (? package? package) sub-drv ...)
+ (mlet %store-monad ((drv (package->derivation package)))
+ (return `(,name ,drv ,@sub-drv))))
+ ((name (? string? file))
+ (return `(,name ,file)))
+ (tuple
+ (return tuple)))
+ inputs))))
+
(define derivation-expression
(store-lift build-expression->derivation))