diff --git a/pkgs/tools/misc/grub/default.nix b/pkgs/tools/misc/grub/default.nix index 4e795fd6607e..8b56473f87ab 100644 --- a/pkgs/tools/misc/grub/default.nix +++ b/pkgs/tools/misc/grub/default.nix @@ -60,12 +60,12 @@ let riscv64-linux.target = "riscv64"; }; - canEfi = lib.any (system: stdenv.hostPlatform.system == system) ( - lib.mapAttrsToList (name: _: name) efiSystemsBuild - ); - inPCSystems = lib.any (system: stdenv.hostPlatform.system == system) ( - lib.mapAttrsToList (name: _: name) pcSystems - ); + xenSystemsBuild = { + i686-linux.target = "i386"; + x86_64-linux.target = "x86_64"; + }; + + inPCSystems = lib.any (system: stdenv.hostPlatform.system == system) (lib.attrNames pcSystems); gnulib = fetchFromSavannah { repo = "gnulib"; @@ -88,6 +88,10 @@ let hash = "sha256-IoRiJHNQ58y0UhCAD0CrpFiI8Mz1upzAtyh5K4Njh/w="; }; in + +assert zfsSupport -> zfs != null; +assert !(efiSupport && xenSupport); + stdenv.mkDerivation rec { pname = "grub"; version = "2.12"; @@ -605,7 +609,7 @@ stdenv.mkDerivation rec { ] ++ lib.optionals xenSupport [ "--with-platform=xen" - "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}" + "--target=${xenSystemsBuild.${stdenv.hostPlatform.system}.target}" ]; # save target that grub is compiled for @@ -653,16 +657,13 @@ stdenv.mkDerivation rec { license = licenses.gpl3Plus; platforms = - if xenSupport then - [ - "x86_64-linux" - "i686-linux" - ] + if efiSupport then + lib.attrNames efiSystemsBuild + else if xenSupport then + lib.attrNames xenSystemsBuild else platforms.gnu ++ platforms.linux; maintainers = [ ]; - - broken = !(efiSupport -> canEfi) || !(zfsSupport -> zfs != null) || (efiSupport && xenSupport); }; }