Forrest logo
back to the nixos-rebuild tool

nixos-rebuild:tldr:e72bb

nixos-rebuild: Rollback changes to the configuration, switching to the previous generation.
$ sudo nixos-rebuild switch --rollback
try on your machine

The command sudo nixos-rebuild switch --rollback is used in NixOS to revert a system configuration change and roll back to a previous configuration.

Here's a breakdown of the command:

  • sudo: This is used to execute the command as a superuser or administrator. It may prompt for the password before executing the command.

  • nixos-rebuild: This is a command in NixOS used to manage system configurations. It allows you to build and switch to different system configurations.

  • switch: This is a subcommand of nixos-rebuild that performs the actual switch to a new system configuration.

  • --rollback: This flag is used to specify that the switch should be rolled back to a previous system configuration instead of applying a new one. It tells NixOS to revert the changes made during the last system configuration update.

By running this command, NixOS will revert to the previously active system configuration, undoing any changes made during the last update. This can be useful if the new configuration caused issues or if you want to switch back to a known working configuration.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nixos-rebuild tool