Merge branch 'install-bootloader-flag'

+21 -10
+5 -6
nixos/doc/manual/man-nixos-rebuild.xml
··· 29 </group> 30 <sbr /> 31 <arg><option>--upgrade</option></arg> 32 - <arg><option>--install-grub</option></arg> 33 <arg><option>--no-build-nix</option></arg> 34 <arg><option>--fast</option></arg> 35 <arg><option>--rollback</option></arg> ··· 212 </varlistentry> 213 214 <varlistentry> 215 - <term><option>--install-grub</option></term> 216 <listitem> 217 - <para>Causes the GRUB boot loader to be (re)installed on the 218 - device specified by the 219 - <varname>boot.loader.grub.device</varname> configuration 220 - option.</para> 221 </listitem> 222 </varlistentry> 223
··· 29 </group> 30 <sbr /> 31 <arg><option>--upgrade</option></arg> 32 + <arg><option>--install-bootloader</option></arg> 33 <arg><option>--no-build-nix</option></arg> 34 <arg><option>--fast</option></arg> 35 <arg><option>--rollback</option></arg> ··· 212 </varlistentry> 213 214 <varlistentry> 215 + <term><option>--install-bootloader</option></term> 216 <listitem> 217 + <para>Causes the boot loader to be (re)installed on the 218 + device specified by the relevant configuration options. 219 + </para> 220 </listitem> 221 </varlistentry> 222
+1 -1
nixos/modules/installer/tools/nixos-install.sh
··· 260 # configuration. 261 echo "finalising the installation..." 262 if [ -z "$noBootLoader" ]; then 263 - NIXOS_INSTALL_GRUB=1 chroot $mountPoint \ 264 /nix/var/nix/profiles/system/bin/switch-to-configuration boot 265 fi 266
··· 260 # configuration. 261 echo "finalising the installation..." 262 if [ -z "$noBootLoader" ]; then 263 + NIXOS_INSTALL_BOOTLOADER=1 chroot $mountPoint \ 264 /nix/var/nix/profiles/system/bin/switch-to-configuration boot 265 fi 266
+5 -1
nixos/modules/installer/tools/nixos-rebuild.sh
··· 33 action="$i" 34 ;; 35 --install-grub) 36 - export NIXOS_INSTALL_GRUB=1 37 ;; 38 --no-build-nix) 39 buildNix=
··· 33 action="$i" 34 ;; 35 --install-grub) 36 + echo "$0: --install-grub deprecated, use --install-bootloader instead" >&2 37 + export NIXOS_INSTALL_BOOTLOADER=1 38 + ;; 39 + --install-bootloader) 40 + export NIXOS_INSTALL_BOOTLOADER=1 41 ;; 42 --no-build-nix) 43 buildNix=
+5 -1
nixos/modules/system/boot/loader/grub/install-grub.pl
··· 508 my $versionDiffer = get("fullVersion") ne $prevGrubState->version; 509 my $efiDiffer = $efiTarget ne $prevGrubState->efi; 510 my $efiMountPointDiffer = $efiSysMountPoint ne $prevGrubState->efiMountPoint; 511 - my $requireNewInstall = $devicesDiffer || $nameDiffer || $versionDiffer || $efiDiffer || $efiMountPointDiffer || (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1"); 512 513 # install a symlink so that grub can detect the boot drive 514 my $tmpDir = File::Temp::tempdir(CLEANUP => 1) or die "Failed to create temporary space";
··· 508 my $versionDiffer = get("fullVersion") ne $prevGrubState->version; 509 my $efiDiffer = $efiTarget ne $prevGrubState->efi; 510 my $efiMountPointDiffer = $efiSysMountPoint ne $prevGrubState->efiMountPoint; 511 + if (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1") { 512 + warn "NIXOS_INSTALL_GRUB env var deprecated, use NIXOS_INSTALL_BOOTLOADER"; 513 + $ENV{'NIXOS_INSTALL_BOOTLOADER'} = "1"; 514 + } 515 + my $requireNewInstall = $devicesDiffer || $nameDiffer || $versionDiffer || $efiDiffer || $efiMountPointDiffer || (($ENV{'NIXOS_INSTALL_BOOTLOADER'} // "") eq "1"); 516 517 # install a symlink so that grub can detect the boot drive 518 my $tmpDir = File::Temp::tempdir(CLEANUP => 1) or die "Failed to create temporary space";
+5 -1
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
··· 7 import glob 8 import tempfile 9 import errno 10 11 def copy_if_not_exists(source, dest): 12 if not os.path.exists(dest): ··· 92 parser.add_argument('default_config', metavar='DEFAULT-CONFIG', help='The default NixOS config to boot') 93 args = parser.parse_args() 94 95 - # We deserve our own env var! 96 if os.getenv("NIXOS_INSTALL_GRUB") == "1": 97 if "@canTouchEfiVariables@" == "1": 98 subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "install"]) 99 else:
··· 7 import glob 8 import tempfile 9 import errno 10 + import warnings 11 12 def copy_if_not_exists(source, dest): 13 if not os.path.exists(dest): ··· 93 parser.add_argument('default_config', metavar='DEFAULT-CONFIG', help='The default NixOS config to boot') 94 args = parser.parse_args() 95 96 if os.getenv("NIXOS_INSTALL_GRUB") == "1": 97 + warnings.warn("NIXOS_INSTALL_GRUB env var deprecated, use NIXOS_INSTALL_BOOTLOADER", DeprecationWarning) 98 + os.environ["NIXOS_INSTALL_BOOTLOADER"] = "1" 99 + 100 + if os.getenv("NIXOS_INSTALL_BOOTLOADER") == "1": 101 if "@canTouchEfiVariables@" == "1": 102 subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "install"]) 103 else: