nixos/grub: don't die on EFI-only systems if devices != ["nodev"]
Without this change, GRUB installation on non-PC systems (such as
aarch64-linux) only works if boot.loader.grub.devices is set to exactly
`["nodev"]`. If boot.loader.grub.devices was any other value (including
the default `[]`), users got the error:
Died at /nix/store/an9ngv2vg95bdcy0ifsxlbkasprm4dcw-install-grub.pl line 586.
install-grub.pl verifies that if both $grub and $grubEfi are set, then
$grubTarget (e.g. i386-pc) and $grubTargetEfi (e.g. x86_64-efi) must
both be set, or the script will `die`. On non-PC systems, $grubTarget
is "".
When boot.loader.grub.devices is ["nodev"], $grub is set to null,
disabling non-EFI installation. But if a user has devices set for an
x86_64 config, or is using only mirroredBoots without setting devices,
they will hit this `die`.
This change sets $grub to "" if $grubTarget is "".
This commit is contained in:
@@ -40,7 +40,10 @@ let
|
||||
backgroundColor = f cfg.backgroundColor;
|
||||
entryOptions = f cfg.entryOptions;
|
||||
subEntryOptions = f cfg.subEntryOptions;
|
||||
grub = f grub;
|
||||
# PC platforms (like x86_64-linux) have a non-EFI target (`grubTarget`), but other platforms
|
||||
# (like aarch64-linux) have an undefined `grubTarget`. Avoid providing the path to a non-EFI
|
||||
# GRUB on those platforms.
|
||||
grub = f (if (grub.grubTarget or "") != "" then grub else "");
|
||||
grubTarget = f (grub.grubTarget or "");
|
||||
shell = "${pkgs.runtimeShell}";
|
||||
fullName = lib.getName realGrub;
|
||||
|
||||
Reference in New Issue
Block a user