[Nix-dev] confusing rollback / generation system

Linus acc at sphalerite.org
Fri May 19 02:06:33 CEST 2017


On 18 May 2017 23:40:22 BST, Stefan Huchler <stefan.huchler at mail.de> wrote:
>Vladimír Čunát <vcunat at gmail.com> writes:
>
>> Oh, you mean the system-wide profile?  (i.e.
>> /nix/var/nix/profiles/system)  That's the root's profile.  If you use
>> `nix-env` as root, it will operate on that by default.  You typically
>> need elevated privileges, but it's probably possible to change
>> permissions of that directory...
>
>At least for --list-generations operation that is not true tested on 2
>machines. I have to set the system-directory parameter to get access to
>it.
>
>bash-4.4# nix-env --list-generations
>  16   2017-01-10 09:28:31   (current)
>
>bash-4.4# nix-env --list-generations -p /nix/var/nix/profiles/system
>  71   2017-04-02 20:01:34   
>  72   2017-04-23 15:36:07   (current)
>
>_______________________________________________
>nix-dev mailing list
>nix-dev at lists.science.uu.nl
>https://mailman.science.uu.nl/mailman/listinfo/nix-dev

Yes, nix-env as root operates on the *default* profile (which applies to all users but is independent of nixos-rebuild) and not the *system* profile (which is operated on by nixos-rebuild) by default.

I totally agree that this is confusing and that it would be nice to perform operations on the system profile using the same set of commands as for other profiles, as some can't be performed without using the wordy nix-env -p /nix/var/nix/profiles/system. The options provided by nix-collect-garbage are far too limited, and affect user profiles in addition to the system profile, and AFAIU using nix-env -p /nix/var/nix/profiles/system --switch-to-generation xyz won't go as intended.

In short: I think nixos-rebuild should support the same generation-management commands as nix-env (--list-generations, --delete-generations, --switch-to-generation, don't know if there are any more I've missed) for consistency and ease of use. Deleting system generations and leaving user profiles alone is currently a pain, unnecessarily so.


(All this IMHO)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170519/c1d2e297/attachment-0001.html>


More information about the nix-dev mailing list