[Nix-dev] confusing rollback / generation system

Stefan Huchler stefan.huchler at mail.de
Thu May 18 23:27:58 CEST 2017


Vladimír Čunát <vcunat at gmail.com> writes:

> On 05/18/2017 08:32 PM, Stefan Huchler wrote:

>> The first question is why do I need to specify a path and use a nix tool
>> when I want to make nixos system rollback?  searching this path always is not
>> very funny.
>
> You don't need to.  You can run just `nix-env --rollback` repeatedly to
> get to the generation you want.  Note that it's just a linear list; that
> might have "confusing consequences" when you alternate appending items
> with rollbacks.

with nix-env --list-generations I get that 15-19 generation stuff so
nix-env rollback would operate on that right?

So I need to give the system-path to operate on... to take actions on
it. I dont see how to get around that...

Also repetingly do --rollback 10 times is no good option in my
oppinion... giving a number as parameter makes more sense to
me... which works for nix-channel --rollback but not for nix-env
--rollback which is inconsistent.


>> Why cant I use some sort of nixos-env --delete-generations without a
>> path? And why cant I use like with nix-channel not 198 as parameter to
>> rollback instead of using switch + delete manually?
>
> If you want to delete all but the current generation or similar actions,
> there's `nix-collect-garbage -d` (see docs for more details).

delete older does not help when I want to go back... I would need some
sort of --delete-newer-than...


> Channels have an independent list of generations, "unrelated" to the
> generations of installed stuff (nix-env --list-generations).  Anyway,
> you probably want to remove the 17.03 URL, replace it, and run channel
> update.

Yes that is what I did... still the need of writing the path to the
system-profile is dumb in my oppinion... make some sort of --system
switch or something...

Its just some guessing and trying around thinking that I might need
still a backup of the system... cause there seems so much you can make
wrong.

Sorry maybe I am nidpicking... I dont want to whine but maybe somebody
sees that as good feedback for improvements.

make a nix-env --system or nixos-env tool that operates on the os-level,
or integrate --rollback in nixos-rebuild and rename it maybe to
nixos-ctl or something like that.

> --Vladimir
>
> P.S.
> I personally often like to hand-manage this stuff, as the commands are
> just a rather thin layer around the underlying files.
> $HOME/.nix-channels is a really trivial list.  Profiles are simple
> symlinks.  It's often easier for me to use standard tools for
> manipulation with files and text files.

At least I know I did not start a atomic missle and it was kind of
correct what I did, even it feeled very strange...



More information about the nix-dev mailing list