Short answer
No. nixos-rebuild switch --rollback activates the previous generation as /run/current-system, but it does not reliably promote that generation to the bootloader default for the next reboot. Whether the rolled-back entry boots automatically depends on your bootloader, the boot.loader defaults in your configuration, and whether the menu timeout exposes older entries.
Confirmed facts
- NixOS retains previous generations under
/nix/var/nix/profiles/system-*-link and presents them as bootloader entries.
/run/current-system identifies the activated generation, and nixos-version reports it.
- GRUB default entry is controlled by
boot.loader.grub.default and the generated grub.cfg.
- systemd-boot default entry is controlled by
boot.loader.systemd-boot.default together with timeout.
- A
timeout = 0 or hidden timeout can make rolled-back entries unselectable even when they exist.
Likely explanation
Rollback changes the active system profile, but it may not rewrite the bootloader default or reinstall the bootloader. If the failed generation remains the configured default, the machine can boot it again unless you manually choose the rolled-back entry at the menu. Exact default-entry semantics vary by NixOS release; treat version-specific behavior as unverified until you check your installed release.
Steps for this case
- Confirm the enabled bootloader in
/etc/nixos/configuration.nix: boot.loader.grub.enable or boot.loader.systemd-boot.enable.
- Identify the rolled-back generation's entry title or ID. For systemd-boot, list
/boot/loader/entries. For GRUB, inspect menuentry titles in grub.cfg. Do not copy an example title without verifying it exists on your system.
- Set the corresponding
boot.loader default option to that entry title or ID.
- If the timeout is zero or hidden, increase
boot.loader.grub.timeout or boot.loader.systemd-boot.timeout so the menu remains reachable.
- Run
sudo nixos-rebuild switch to regenerate bootloader configuration, then reboot and confirm the rolled-back generation starts without manual menu selection.
Read-only verification commands
ls -l /nix/var/nix/profiles/system
nixos-version
ls /boot/loader/entries
grep menuentry /boot/grub/grub.cfg | head -n 20
Missing diagnostic that changes the recommendation: which bootloader you use and the exact entry title or ID of the rolled-back generation. GRUB and systemd-boot use different identifiers, so the default value cannot be determined without this detail.
Assumption: this covers standard GRUB and systemd-boot installations. EFI variable access, secure boot, or custom bootloader hooks may require additional steps outside this guidance.