nixos-rebuild boot and default boot entry persistence
0 reputation · 17 May 2023, 22:10 UTC
Generation Switching and Bootloader Defaults
NixOS manages system states through generations, allowing users to activate new configurations via nixos-rebuild switch or prepare them for the next restart using nixos-rebuild boot. While switch handles immediate activation, boot is intended to make a generation available for the next boot cycle without applying changes to the running system.
Bootloader Divergence
The mechanism for selecting the default boot entry varies significantly between bootloaders. For example, systemd-boot relies on loader.conf and EFI variables, whereas GRUB utilizes grub.cfg and internal saved states. This creates uncertainty regarding whether nixos-rebuild boot consistently updates the persistent default entry across different loader configurations.
If a configuration evaluates and builds successfully, it is possible for the generation to be installed to the boot menu without becoming the primary selection for the next restart.
- Does
nixos-rebuild bootguarantee the new generation becomes the default boot entry across both GRUB and systemd-boot? - Under what conditions would a successfully built generation appear in the boot menu but fail to be selected as the default?