Subject: bug#41541: merge wip-hurd-vm

From: Mathieu Othacehe <[email-masked]>
Date: Wed, 27 May 2020 12:01:25 +0200

Hello Jan,

That's a good summary of the (complex) situation, thank you!

> Mattieu is looking into cleaning up of
>
> b605a36031 * origin/wip-hurd-vm WIP hurd-directives

About that, I'd like to limit at maximum the (if hurd ...) conditionals
in (gnu system image).

So for the "make-device-node", I would propose to "link" it to the
image definition, as proposed in the attached patch.

I'll see if we can do something similar for the "extra-directives" and
the "boot-activation".

Thanks,

Mathieu

>From 371f2bab466cef53f66ac69927014278055572fc Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <[email-masked]>
Date: Wed, 27 May 2020 10:56:13 +0200
Subject: [PATCH] hurd nodes

---
 gnu/build/image.scm  |  5 +++++
 gnu/system/image.scm | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 087e2c78d9..d0722616f2 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -157,6 +157,8 @@ deduplicates files common to CLOSURE and the rest of PREFIX."
                                     references-graphs
                                     (register-closures? #t)
                                     system-directory
+                                    (make-device-nodes
+                                     make-essential-device-nodes)
                                     #:allow-other-keys)
   "Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to
 install the bootloader configuration.
@@ -168,6 +170,9 @@ of the directory of the 'system' derivation."
   (populate-root-file-system system-directory root)
   (populate-store references-graphs root)
 
+  ;; Populate /dev.
+  (make-device-nodes root)
+
   (when register-closures?
     (for-each (lambda (closure)
                 (register-closure root
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 03588f7d38..67e560891b 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -89,6 +89,13 @@
    (flags '(boot))
    (initializer (gexp initialize-root-partition))))
 
+(define hurd-initialize-root-partition
+  #~(lambda* (#:rest args)
+      (apply initialize-root-partition
+             (append args
+                     (list #:make-device-nodes
+                           make-hurd-device-nodes)))))
+
 (define hurd-disk-image
   (image
    (format 'disk-image)
@@ -99,7 +106,7 @@
            (label root-label)
            (file-system "ext2")
            (flags '(boot))
-           (initializer (gexp initialize-root-partition)))))))
+           (initializer hurd-initialize-root-partition))))))
 
 (define efi-disk-image
   (image
@@ -154,12 +161,14 @@
     (with-imported-modules `(,@(source-module-closure
                                 '((gnu build vm)
                                   (gnu build image)
+                                  (gnu build linux-boot)
                                   (guix store database))
                                 #:select? not-config?)
                              ((guix config) => ,(make-config.scm)))
       #~(begin
           (use-modules (gnu build vm)
                        (gnu build image)
+                       (gnu build linux-boot)
                        (guix store database)
                        (guix build utils))
           gexp* ...))))
-- 
2.26.2