[Nix-dev] (sudo (-H)) nix-collect-garbage

Eelco Dolstra eelco.dolstra at logicblox.com
Mon Jul 2 16:39:03 CEST 2012


Hi,

On 02/07/12 10:09, Florian Friesdorf wrote:

> can somebody explain me what is going on here? Summary:
> 
> - garbage collect as user
> - rerun garbage collect as user -> nothing to do
> - sudo garbage collect -> more work to do including scary
>   'invalidating' actions
> 
> Why is root garbage collecting more than user?

Because you're using sudo and sudo doesn't propagate the $NIX_CONF_DIR
environment variable.  Because of this the Nix configuration file in
/etc/nix/nix.conf won't be used.  By default it contains a line "gc-keep-outputs
= true" which prevents the outputs of derivations from being garbage collected.
 This explains that "sudo nix-collect-garbage" will suddenly garbage-collect
tarballs like "xmonad-0.10.tar.gz".

Maybe we should add an "env_keep" line for $NIX_CONF_DIR to sudoers.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list