How to revert NixOS channel version back to the version used in specific boot entry (generation)?
I’m running NixOS unstable, and I’ve done nixos-rebuild boot --upgrade
few times, and figured out some app is broken. It is probably some temporary incompatibility / breaking change in dependencies, that will eventually get resolved.
I managed to identify, and I’m running (booted), the fully working generation now:
- the fully working generation is a few generations back – not the previous one.
Now, next I would like to get to the state before those upgrades:
- I want to revert to the fully working generation:
- make it the default boot generation,
- or create a new (identical) one placed on top of all generations,
- I want to revert nix channel to version used by this generation:
- be able to make changes to
configuration.nix
and apply them withnixos-rebuild
.
- be able to make changes to
sudo nix-channel --rollback N
reverts channels to generation N
. You can use this to revert to the currently running generation: sudo nix-channel --rollback "$(grep --files-with-matches --fixed-strings "$(cut --delimiter=. --fields=3 /run/current-system/nixos-version)" /nix/var/nix/profiles/per-user/root/channels-*-link/nixos/svn-revision | tail --lines=1 | cut --delimiter=- --fields=3)"