On 18 May 2017 23:40:22 BST, Stefan Huchler <stefan.huch...@mail.de> wrote:
>Vladimír Čunát <vcu...@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@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)
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to