summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-17 13:30:49 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-17 13:30:49 +0200
commitb33657df03e411441625019f1cfe1e1b08135497 (patch)
tree4db593d244a3bc818739bcc7ee2c43360ce8eef0
parent34d61c53c2c95f9c2a3bf05b3d08504ebbde642c (diff)
downloadnixlib-b33657df03e411441625019f1cfe1e1b08135497.tar
nixlib-b33657df03e411441625019f1cfe1e1b08135497.tar.gz
nixlib-b33657df03e411441625019f1cfe1e1b08135497.tar.bz2
nixlib-b33657df03e411441625019f1cfe1e1b08135497.tar.lz
nixlib-b33657df03e411441625019f1cfe1e1b08135497.tar.xz
nixlib-b33657df03e411441625019f1cfe1e1b08135497.tar.zst
nixlib-b33657df03e411441625019f1cfe1e1b08135497.zip
grub: Make assertion lazier
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 8e9f3253f877..c7c1f675c778 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -237,13 +237,14 @@ in
 
     boot.loader.grub.devices = optional (cfg.device != "") cfg.device;
 
-    system.build = mkAssert (cfg.devices != [])
-      "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
-      { installBootLoader =
-          "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
-          "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
-        inherit grub;
-      };
+    system.build.installBootLoader =
+      if cfg.devices == [] then
+        throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
+      else
+        "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
+        "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
+
+    system.build.grub = grub;
 
     # Common attribute for boot loaders so only one of them can be
     # set at once.