From 894d47f9896096587aed6028099a90430355199d Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Wed, 8 Mar 2023 02:18:37 -0500 Subject: [PATCH] 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. --- nixos/modules/system/boot/loader/grub/install-grub.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl index 27f03f2fb58c..f301d838f663 100644 --- a/nixos/modules/system/boot/loader/grub/install-grub.pl +++ b/nixos/modules/system/boot/loader/grub/install-grub.pl @@ -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"; }