grub2: refactor platforms logic, avoid abusing meta.broken (#428878)

This commit is contained in:
Wolfgang Walther
2025-08-04 11:17:53 +00:00
committed by GitHub
+15 -14
View File
@@ -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);
};
}