Rolling back a channel

FWIW, I’ve just had to rollback a second time (discourse topic), and I discovered /run/current-system/bin/switch-to-configuration boot which is better than sudo nixos-rebuild switch --rollback.

Rollback rolls you back from the current, broken generation, to the previous one, which is hopefully working. This isn’t an ideal workflow, because:

  • you need to be booted up into the broken gen,
  • you need to remember that the previous gen is OK (which it might actually not be)

What switch-to-configuration does is it makes the current configuration default. So the workflow is:

  • you do upgrade
  • you reboot
  • you notice stuff is broken
  • you reboot into the generation which works for you (not necessary the previous one)
  • you verify that it indeed works
  • you make it current by running /run/current-system/bin/switch-to-configuration boot
5 Likes