summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-04-09 13:27:18 -0500
committerWilliam A. Kennington III <william@wkennington.com>2014-08-28 13:35:34 -0700
commit3c6e2fbba910cd3f110a0388c0a374d1573082ef (patch)
tree8e8efc66fdf7fb7d046dbe29665677a451f5ec54 /nixos/modules/system
parentf2bef62716b4c5853ea16465f31182569dbb80ef (diff)
downloadnixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.tar
nixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.tar.gz
nixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.tar.bz2
nixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.tar.lz
nixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.tar.xz
nixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.tar.zst
nixlib-3c6e2fbba910cd3f110a0388c0a374d1573082ef.zip
Add optional zfsSupport to the nixos grub configuration
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index a3b09223cbb8..25cec57431e1 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -6,7 +6,8 @@ let
 
   cfg = config.boot.loader.grub;
 
-  realGrub = if cfg.version == 1 then pkgs.grub else pkgs.grub2;
+  realGrub = if cfg.version == 1 then pkgs.grub
+    else pkgs.grub2.override { zfsSupport = cfg.zfsSupport };
 
   grub =
     # Don't include GRUB if we're only generating a GRUB menu (e.g.,
@@ -209,6 +210,14 @@ in
         '';
       };
 
+      zfsSupport = mkOption {
+        default = false;
+        type = types.bool;
+        description = ''
+          Whether grub should be build against libzfs.
+        '';
+      };
+
     };
 
   };
@@ -251,6 +260,9 @@ in
           ${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
         '') config.boot.loader.grub.extraFiles);
 
+    assertions = [{ assertion = !cfg.zfsSupport || cfg.version == 2;
+                    message = "Only grub version 2 provides zfs support";}];
+
     })
 
   ];