Subject: [PATCH] scripts: system: Handle unspecified bootloader package and installer.

From: Mathieu Othacehe <[email-masked]>
Date: Sun, 21 May 2017 15:57:15 +0200

* guix/scripts/system.system (perform-action): If bootloader installer or
  bootloader package are #f, do not add them to drvs but keep things going.

This allows to write (installer #f) or (package #f) in <bootloader>
definition.

Reported-by: Clément Lassieur <[email-masked]>.

---
 guix/scripts/system.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 5e4574f7c..0e29d3c05 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -653,19 +653,20 @@ output when building a system derivation, such as a disk image."
        (bootloader-installer
         (let ((installer (bootloader-installer bootloader))
               (target    (or target "/")))
-          (bootloader-installer-derivation installer
-                                           bootloader-package
-                                           device target)))
+          (if installer
+              (bootloader-installer-derivation installer
+                                               bootloader-package
+                                               device target)
+              (return #f))))
 
        ;; For 'init' and 'reconfigure', always build BOOTCFG, even if
        ;; --no-bootloader is passed, because we then use it as a GC root.
        ;; See <http://bugs.gnu.org/21068>.
        (drvs   -> (if (memq action '(init reconfigure))
-                      (if (and install-bootloader? bootloader-package)
-                          (list sys bootcfg
-				bootloader-package
-				bootloader-installer)
-                          (list sys bootcfg))
+                      (delete #f
+                              (list sys bootcfg
+                                    bootloader-package
+                                    bootloader-installer))
                       (list sys)))
        (%         (if derivations-only?
                       (return (for-each (compose println derivation-file-name)
-- 
2.13.0