From 3c6e2fbba910cd3f110a0388c0a374d1573082ef Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 9 Apr 2014 13:27:18 -0500 Subject: [PATCH] Add optional zfsSupport to the nixos grub configuration --- nixos/modules/system/boot/loader/grub/grub.nix | 14 +++++++++++++- pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) 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";}]; + }) ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c5b511df9c02..2dc957cb3db3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1222,6 +1222,8 @@ let grub2_efi = grub2.override { EFIsupport = true; }; + grub2_zfs = grub2.override { zfsSupport = true; }; + gssdp = callPackage ../development/libraries/gssdp { inherit (gnome) libsoup; };