[Nix-dev] Non-Garbage-Collected Development Environments

Tomasz Kontusz tomasz.kontusz at gmail.com
Sun Dec 20 18:51:46 CET 2015


I think the nix-instantiate trick will only stop the GC if you have 
"gc-keep-outputs = true" in nix.conf.

On 20.12.2015 18:16, Bas van Dijk wrote:
> Hello,
>
> At LumiGuide we're working on several projects. Each project has its
> own attribute. To work on a project we can use nix-shell to enter a
> development environment for that project like:
>
>    nix-shell -A myProject
>
> The problem is that once in a while our engineers need to garbage
> collect their systems. When they run nix-collect-garbage some or all
> of the dependencies of myProject might get collected. How can I
> prevent this from happening?
>
> I tried using the approach described in the wiki [1]. We can register
> myProject.drv as a garbage collector root:
>
>    $ nix-instantiate -A myProject \
>        --indirect --add-root $PWD/myProject.drv
>
> Then we can enter the environment using:
>
>    $ nix-shell $PWD/myProject.drv
>
> However, this doesn't prevent the dependencies from being collected
> since myProject.drv only depends on the .drv files of the
> dependencies, i.e. not the actual realized store paths.
>
> I think myEnvFun might be the solution but the wiki mentions it's
> deprecated. Does anybody know what I should use instead?
>
> Cheers,
>
> Bas
>
> [1] https://nixos.org/wiki/Development_Environments
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



More information about the nix-dev mailing list