[Nix-dev] Re: nix-store --gc doesn't honor gc-keep-outputs

Eelco Dolstra e.dolstra at tudelft.nl
Wed Jan 6 12:47:50 CET 2010


Hi,

Peter Simons wrote:

>  >  > I can't reproduce this: [...]
>  >
>  > I can reproduce that error on three different platforms using 0.14pre19016. No
>  > matter whether it's Linux/x86, Linux/x86_64, or Darwin/x86, nix-collect-garbage
>  > expires all source code tarballs regardless of the "gc-keep-outputs = true"
>  > setting in ~/.nix-profile/etc/nix/nix.conf. I even tried it again after
>  > re-building the entire Nix installation from scratch, but that made no
>  > difference:
>  >
>  >   peter at binx:~/.nix-defexpr$ nix-build -A aterm25.src
>  >   /home/peter/.nix/store/kylbqbscm6mn4jkrcbn65fbjpdr5d7g9-aterm-2.5.tar.gz
>  >
>  >   peter at binx:~/.nix-defexpr$ nix-build -A aterm25
>  >   the following derivations will be built:
>  >     /home/peter/.nix/store/7x1wsx8pswprk6rb0v87cf9k4va9293j-aterm-2.5.drv
>  >   building path(s) `/home/peter/.nix/store/4wkga4qcwxyp0gfiv8p1qpdszh2wxxb9-aterm-2.5'
>  >   [...]
>  >   scanning for references inside `/home/peter/.nix/store/4wkga4qcwxyp0gfiv8p1qpdszh2wxxb9-aterm-2.5'
>  >   /home/peter/.nix/store/4wkga4qcwxyp0gfiv8p1qpdszh2wxxb9-aterm-2.5
>  >
>  >   peter at binx:~/.nix-defexpr$ nix-store --delete /home/peter/.nix/store/kylbqbscm6mn4jkrcbn65fbjpdr5d7g9-aterm-2.5.tar.gz --option gc-keep-outputs true
>  >   finding garbage collector roots...
>  >   removing stale link from `/home/peter/.nix/var/nix/gcroots/auto/xlllqwbrjr2bshjchadm51q082flzn5x' to `/a/roast/vol/vol0/home/peter/nix-pkgs/.nix-build-tmp-derivation'
>  >   deleting `/home/peter/.nix/store/kylbqbscm6mn4jkrcbn65fbjpdr5d7g9-aterm-2.5.tar.gz'
>  >   1 store paths deleted, 830158 bytes (0.79 MiB, 1632 blocks) freed
> 
> Does anyone have an idea?

As a workaround, you can register the derivation as a garbage collector root. E.g.

$ nix-build -A aterm25 --add-drv-link

The symlink "./derivation" should prevent the derivation and its outputs from
being GC'ed.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list