Subject: [bug#29296] [PATCH 2/2] gexp: Add 'let-system'.

From: [email-masked] (Ludovic Courtès)
Date: Thu, 16 Nov 2017 10:10:58 +0100

Hi Mathieu,

Mathieu Othacehe <[email-masked]> skribis:

> I must admit i don't have a perfect understanding of what is going on in
> gexp.scm but your serie LGTM.
>
> When diffing with the initial patch it seems that the entry in
> .dir-locals.el is gone but it is a minor point.

Oops.

> About the integration of let-system in "system-disk-image", i'm not sure
> how to proceed. let-system is meant to be used in a gexp but the
> operating-system is not defined in a gexp.
>
> Do you have any advice on how to turn os declaration into a gexp so that
> i can use let-system to parameterize kernel field ?

The idea is that you can write:

  (kernel (let-system system
            (if (string-prefix? "arm-" system)
                linux-libre-arm
                linux-libre)))

and things will just work.

Now I found a couple of issues.  First one is addressed with the patch
below.  Second one is trickier: (file-append (let-system …) …), as is
used to compute the kernel file name, doesn’t work due to the way the
<file-append> expander works.

I’ll see what I can do.

Thanks,
Ludo’.

diff --git a/gnu/system.scm b/gnu/system.scm
index 9e05c4b21..a4804cf86 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -876,10 +876,12 @@ listed in OS.  The C library expects to find it under
 
 (define (kernel->boot-label kernel)
   "Return a label for the bootloader menu entry that boots KERNEL."
-  (string-append "GNU with "
-                 (string-titlecase (package-name kernel)) " "
-                 (package-version kernel)
-                 " (beta)"))
+  (if (package? kernel)
+      (string-append "GNU with "
+                     (string-titlecase (package-name kernel)) " "
+                     (package-version kernel)
+                     " (beta)")
+      "GNU GuixSD (beta)"))
 
 (define (store-file-system file-systems)
   "Return the file system object among FILE-SYSTEMS that contains the store."