guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: system: Use 'source-module-closure' where needed.


From: Ludovic Courtès
Subject: 04/04: system: Use 'source-module-closure' where needed.
Date: Sun, 4 Sep 2016 22:07:34 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 239c6e276214813f59f761c9dc5cc0e9d266b49b
Author: Ludovic Courtès <address@hidden>
Date:   Sun Sep 4 23:42:50 2016 +0200

    system: Use 'source-module-closure' where needed.
    
    * gnu/system/vm.scm (%vm-module-closure): Remove.
    (expression->derivation-in-linux-vm): Use 'source-module-closure'
    instead of %VM-MODULE-CLOSURE.
    (qemu-image): Likewise.
    * gnu/system/linux-initrd.scm (expression->initrd): Likewise.
    (flat-linux-module-directory, base-initrd): Likewise.
    * gnu/system/mapped-devices.scm (open-luks-device): Likewise.
---
 gnu/system/linux-initrd.scm   |   25 +++++++++++--------------
 gnu/system/mapped-devices.scm |    5 +++--
 gnu/system/vm.scm             |   22 +++++-----------------
 3 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index bbaa5c0..174239a 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -27,6 +27,7 @@
                 #:select (%store-prefix))
   #:use-module ((guix derivations)
                 #:select (derivation->output-path))
+  #:use-module (guix modules)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages guile)
@@ -66,10 +67,8 @@ the derivations referenced by EXP are automatically copied 
to the initrd."
   (mlet %store-monad ((init (gexp->script "init" exp
                                           #:guile guile)))
     (define builder
-      (with-imported-modules '((guix cpio)
-                               (guix build utils)
-                               (guix build store-copy)
-                               (gnu build linux-initrd))
+      (with-imported-modules (source-module-closure
+                              '((gnu build linux-initrd)))
         #~(begin
             (use-modules (gnu build linux-initrd))
 
@@ -88,9 +87,9 @@ the derivations referenced by EXP are automatically copied to 
the initrd."
   "Return a flat directory containing the Linux kernel modules listed in
 MODULES and taken from LINUX."
   (define build-exp
-    (with-imported-modules '((guix build utils)
-                             (guix elf)
-                             (gnu build linux-modules))
+    (with-imported-modules (source-module-closure
+                            '((guix build utils)
+                              (gnu build linux-modules)))
       #~(begin
           (use-modules (ice-9 match) (ice-9 regex)
                        (srfi srfi-1)
@@ -223,13 +222,11 @@ loaded at boot time in the order in which they appear."
   (mlet %store-monad ((kodir (flat-linux-module-directory linux
                                                           linux-modules)))
     (expression->initrd
-     (with-imported-modules '((guix build bournish)
-                              (guix build utils)
-                              (guix build syscalls)
-                              (gnu build linux-boot)
-                              (gnu build linux-modules)
-                              (gnu build file-systems)
-                              (guix elf))
+     (with-imported-modules (source-module-closure
+                             '((gnu build linux-boot)
+                               (guix build utils)
+                               (guix build bournish)
+                               (gnu build file-systems)))
        #~(begin
            (use-modules (gnu build linux-boot)
                         (guix build utils)
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 7b91fcf..2ce35ea 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -20,6 +20,7 @@
 (define-module (gnu system mapped-devices)
   #:use-module (guix gexp)
   #:use-module (guix records)
+  #:use-module (guix modules)
   #:use-module (gnu services)
   #:use-module (gnu services shepherd)
   #:autoload   (gnu packages cryptsetup) (cryptsetup)
@@ -95,8 +96,8 @@
 (define (open-luks-device source target)
   "Return a gexp that maps SOURCE to TARGET as a LUKS device, using
 'cryptsetup'."
-  (with-imported-modules '((gnu build file-systems)
-                           (guix build bournish))
+  (with-imported-modules (source-module-closure
+                          '((gnu build file-systems)))
     #~(let ((source #$source))
         ;; XXX: 'use-modules' should be at the top level.
         (use-modules (rnrs bytevectors)           ;bytevector?
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index c31e3a8..4c53edc 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -26,6 +26,7 @@
   #:use-module (guix packages)
   #:use-module (guix monads)
   #:use-module (guix records)
+  #:use-module (guix modules)
 
   #:use-module ((gnu build vm)
                 #:select (qemu-command))
@@ -90,21 +91,6 @@
           (options "trans=virtio")
           (check? #f))))
 
-(define %vm-module-closure
-  ;; The closure of (gnu build vm), roughly.
-  ;; FIXME: Compute it automatically.
-  '((gnu build vm)
-    (gnu build install)
-    (gnu build linux-boot)
-    (gnu build linux-modules)
-    (gnu build file-systems)
-    (guix elf)
-    (guix records)
-    (guix build utils)
-    (guix build syscalls)
-    (guix build bournish)
-    (guix build store-copy)))
-
 (define* (expression->derivation-in-linux-vm name exp
                                              #:key
                                              (system (%current-system))
@@ -148,7 +134,8 @@ made available under the /xchg CIFS share."
 
     (define builder
       ;; Code that launches the VM that evaluates EXP.
-      (with-imported-modules %vm-module-closure
+      (with-imported-modules (source-module-closure '((guix build utils)
+                                                      (gnu build vm)))
         #~(begin
             (use-modules (guix build utils)
                          (gnu build vm))
@@ -205,7 +192,8 @@ register INPUTS in the store database of the image so that 
Guix can be used in
 the image."
   (expression->derivation-in-linux-vm
    name
-   (with-imported-modules %vm-module-closure
+   (with-imported-modules (source-module-closure '((gnu build vm)
+                                                   (guix build utils)))
      #~(begin
          (use-modules (gnu build vm)
                       (guix build utils))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]