Rebuilding with new channel, what is point of no return? dry-build? dry-activate? or boot/switch?

In the NixOS upgrade instructions, it warns that:

Warning: It is generally safe to switch back and forth between channels. The only exception is that a newer NixOS may also have a newer Nix version, which may involve an upgrade of Nix’s database schema. This cannot be undone easily, so in that case you will not be able to go back to your original channel.

Where exactly do you incur this potential problem and pass the point at which it is difficult to revert to the previous channel? Just by changing the system channel using sudo nix-channel --add <channel> nixos? Or by doing that and then running nixos-rebuild --upgrade dry-build/dry-activate? Or is it not until nixos-rebuild --upgrade boot/switch?

1 Like

For specifically that nix db problem, the “point of no return” is whenever the new nix-daemon is started. This means either nixos-rebuild switch, nixos-rebuild test, or after rebooting after nixos-rebuild boot.

It’s worth noting that Nix doesn’t often make schema changes like that. I’m pretty sure it hasn’t happened in a long time. Does anyone know the last time it happened? Did the content-addressed changes in 2.4 make a backward incompatible schema change?

It’s also worth noting that any services you use may have backward incompatible changes to on-disk state. Consult their release notes.

And of course, above all else, always have a backup of anything important.