NixOS 23.11 manual | Nix & NixOS says
Packages come from the NixOS channel. You typically upgrade a package
by updating to the latest version of the NixOS channel:$ nix-channel --update nixos
and then running
nix-env -i
again. Other packages in the profile are
not affected; this is the crucial difference with the declarative
style of package management, where runningnixos-rebuild switch
causes all packages to be updated to their current versions in the
NixOS channel.
On NixOS, before running
sudo nixos-rebuild switch
is it necessary to update the channel by
nix-channel update nixos
?
Or will the switch command do the channel update by itself?