Re: [Nix-dev] (sudo (-H)) nix-collect-garbage
All right. I agree that its the best solution. Marc Weber ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] (sudo (-H)) nix-collect-garbage
Hi Marc, On Fri, 27 Jul 2012 12:41:48 +0200, Marc Weber wrote: > Hi Florian, > > before we start propagating any env vars can you make me understand why > a user have a different value than "root"? > > If does this happen intenionally? > > Would exporting NIX_CONF_DIR in profile.sh (nixos repo) be an > alternative? If so why is your solution better? I took the approach already for other env vars (see sudoers) and for NIX_DIR_CONF Eelco suggested to do the same. But, I think we should have a deeper look at sudo, how it can be used and how we are using it -> policy document. The intersting bits are: sudo foo vs. sudo -H foo vs. sudo -i foo NIX_DIR_CONF is exported in /etc/profile, but this is not loaded except for sudo -i. I currently think that bringing certain env vars into the sudo env is the correct way, but I'd appreciate other opinions on that. regards florian -- Florian Friesdorf GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083 Jabber/XMPP: f...@chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC pgpfBkMF8aUIm.pgp Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] (sudo (-H)) nix-collect-garbage
Hi Florian, before we start propagating any env vars can you make me understand why a user have a different value than "root"? If does this happen intenionally? Would exporting NIX_CONF_DIR in profile.sh (nixos repo) be an alternative? If so why is your solution better? Marc Weber ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] (sudo (-H)) nix-collect-garbage
On Mon, 02 Jul 2012 10:39:03 -0400, Eelco Dolstra wrote: > 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. just pushed after testing it locally: % nix-collect-garbage cleaning % sudo nix-collect-garbage nothing to be done % sudo -H nix-collect-garbage nothing to be done -- Florian Friesdorf GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083 Jabber/XMPP: f...@chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC pgp9S7kXCB376.pgp Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] (sudo (-H)) nix-collect-garbage
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/ ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev