Nixos-rebuild interactive

Hi,

working remotely I would feel safer with a nixos-rebuild interactive mode: after nixos-rebuild test or nixos-rebuild switch the user is asked for confirmation, the user failing to confirm would cause a rollback to the previous working configuration.

I’ve been unable to find a similar feature in the nixos documentation.

Am I missing something?

thank you
walter franzini

2 Likes

That’s a great idea. The user would have to commit the changes after the switch.

LumiGuide is doing something similar for their servers, a revert service is started and has to be cancelled by putting a file at a specific location in the filesystem. In their case it happens over SSH but I imagine that it could be generalized to also a UI. This is not part of nixpkgs yet but would be a welcome addition.

Here’s the link to LumiGuide presentation about how they do it for SSH deployments

https://youtu.be/J4DgATIjx9E?t=1182

1 Like

Thanks for the link.

The only thing I do not understand is the rollback-version file. Where it cames from?

@wfranzini the rollback-version file is created/updated when you commit a generation using the following command:

nix-env --list-generations -p /nix/var/nix/profiles/system \
| grep -Po '([0-9]+)(?=\\s+[0-9 -]+ [0-9 :]+\\s*\\(current\\))' \
> /nix/var/nix/rollback-version

This is of course abstracted in our deployment tooling.

1 Like