nixos/grub: Always install with bootloader id

The intent was to not pass the flag when installing as removable. In
reality there is a third case, where you may not want to touch EFI
variables, and not want to install as removable.

In that case, it would install to the generic \EFI\grub\grubx64.efi,
which is not a good choice in any cases. The operating system should
"own" their path under \EFI\ to be a good citizen [citation needed].

With this change, there can be only two paths GRUB can be installed to:

 - \EFI\NixOS-boot\grubx64.efi
 - \EFI\BOOT\bootx64.efi

This removes the surprising behaviour where GRUB may be installed to a
different location only because we configured NixOS not to touch EFI
variables.

It may be necessary under some configurations to install GRUB without
touching EFI variables, but to the NixOS-owned location.
This commit is contained in:
Samuel Dionne-Riel 2023-03-08 02:18:37 -05:00
parent 9e1960bc19
commit 894d47f989

View File

@ -725,9 +725,8 @@ if (($requireNewInstall != 0) && ($efiTarget eq "only" || $efiTarget eq "both"))
if ($forceInstall eq "true") {
push @command, "--force";
}
if ($canTouchEfiVariables eq "true") {
push @command, "--bootloader-id=$bootloaderId";
} else {
push @command, "--bootloader-id=$bootloaderId";
if ($canTouchEfiVariables ne "true") {
push @command, "--no-nvram";
push @command, "--removable" if $efiInstallAsRemovable eq "true";
}