I would like to automate the switch from 20.03 to 20.09 (and later to 21.03 …).
It’s clear that
nix-channel --add https://nixos.org/channels/nixos-20.09 nixos
nixos-rebuild switch --upgrade
… needs to be performed. The above URL will be available before an official release statement is done. At least that’s my experience and an early switch might take me into an unstable situation.
How can I determine that the channel needs to be switched and how can I determine the exact version?
I think you can check visiting this site https://status.nixos.org/ and checking if there is a nixos-20.09
switches to releases are something that you really can’t anticipate the changes to automatically switch to. So I would advise against this.
usually there’s a lot of changes, and the 20.09 release is essentially master right now. If you’re going from 20.03 to 20.09, you will probably want to manually upgrade your system as a lot will change.
Yes — the reason we have stable releases is so that incompatible changes requiring manual action can be bunched up into sets that only need to be taken care of every 6 months. You will need to read the release notes unless you want to be surprised by the incompatible changes, which may break your config in subtle ways — even if it evaluates and builds without any issues, services may fail to start or data may be missing because a previously correct config no longer is correct.
This is also why we don’t have a “nixos-stable” channel.