NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.32k forks source link

Warning if packages --upgrade cannot happen for the current nixOS version / channel #355018

Open adingbatponder opened 2 weeks ago

adingbatponder commented 2 weeks ago

sudo nixos-rebuild switch --upgrade

does not yield a message warning that no upgrade is necessarily made to all packages when it is run, when run at a time when is the case that the current OS version, e.g. 23.11, is past the end of support date and so no packages are upgraded any more in the store for that OS version. A useful message could say that some of the packages in the configuration.nix may require a nixOS upgrade first in order to be upgraded at all. A list of affected passages would be optimal.

The issue is important because at boot the warning that the nixOS is out of date shoots past and is not legible (and nixOS is so stable that rebooting may not take place often ) and the consequences for the --upgrade flag are not clear to novices.

Screenshot_20241110-125151~2

Thanks.

misuzu commented 2 weeks ago

The NixOS 23.11 is EOL and doesn't receive updates. Here's what the --upgrade option does (taken from nixos-rebuild --help):

       --upgrade, --upgrade-all
               Update the root user's channel named ‘nixos’ before rebuilding the system.

               In addition to the ‘nixos’ channel, the root user's channels which have a file named ‘.update-on-nixos-rebuild’ in their base directory will also be updated.

               Passing --upgrade-all updates all of the root user's channels.

To receive updates you have to upgrade to NixOS 24.05 or NixOS unstable. There's a manual entry for upgrading NixOS to the next stable release.

tl;dr:

sudo nix-channel --add https://channels.nixos.org/nixos-24.05 nixos
sudo nix-channel --update nixos
sudo nixos-rebuild boot
sudo reboot
LunNova commented 2 weeks ago

misuzu, I think you missed OP's concern. It's not that they don't know how to upgrade, it's that it's easy to miss the outdated release warning that shows up at boot and we should consider adding the same warning to nixos-rebuild.

misuzu commented 2 weeks ago

There's nothing NixOS-specific that makes that warning, it's a feature of systemd. It just compares SUPPORT_END from /etc/os-release with current date and shows that warning.

The current nixos-rebuild is already a mess and it's better to not make it worse. The nixos-rebuild-ng could probably add a similar logic.

Though if this feature implemented like that it could lead to a confusing situation, e.g. a system runs outdated release and user added a fresh channel but the nixos-rebuild would still spit out the warning.