[Nix-dev] nix-shell and persistent environment

Daniel Hlynskyi abcz2.uprola at gmail.com
Sun Oct 2 21:30:54 CEST 2016


> You do this for keep things in order or because it buys you functionality?

The former. Single shell expression generates many roots:

.nix-gc-roots/dev-shell.drv ->
/nix/store/ivznvsqn40vb6vkccy092ph1ryhlq12w-nixpkgs-patched
.nix-gc-roots/dev-shell.drv-10 ->
/nix/store/4zq1535pa85wkaxlxdrp751jhznlw8ki-stdenv
.nix-gc-roots/dev-shell.drv-11 ->
/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh
.nix-gc-roots/dev-shell.drv-2 ->
/nix/store/9mcsmyj6b2f6k8527yxbbgpj7ahr3w2b-rlwrap-0.42
.nix-gc-roots/dev-shell.drv-2-doc ->
/nix/store/9z2rfwf2pl07l5qf3p2d7b4hqw9gs5h4-bash-4.3-p46-doc
.nix-gc-roots/dev-shell.drv-2-info ->
/nix/store/vd4pq9lxpihd2m86k6hckq30ky5gj2xb-bash-4.3-p46-info
.nix-gc-roots/dev-shell.drv-3 ->
/nix/store/nyj6xd7s1n1w8c0xdwk5ddhi7bjcyi9x-bash-4.3-p46
.nix-gc-roots/dev-shell.drv-3-doc ->
/nix/store/9z2rfwf2pl07l5qf3p2d7b4hqw9gs5h4-bash-4.3-p46-doc
.nix-gc-roots/dev-shell.drv-3-info ->
/nix/store/vd4pq9lxpihd2m86k6hckq30ky5gj2xb-bash-4.3-p46-info
.nix-gc-roots/dev-shell.drv-4 ->
/nix/store/p9sfacfhf35f41nqkw6pa1i8hamn5dha-sshpass-1.05
.nix-gc-roots/dev-shell.drv-5 ->
/nix/store/4kmvzlc587bmx6lbfqy171pim5za36az-sqlite-3.14.1
.nix-gc-roots/dev-shell.drv-5-bin ->
/nix/store/b38jh5lwv42985vymzx3ayj4irz638r0-sqlite-3.14.1-bin
.nix-gc-roots/dev-shell.drv-5-dev ->
/nix/store/kiixbwijnfgb3y46l3avc0rhwl9iqida-sqlite-3.14.1-dev
.nix-gc-roots/dev-shell.drv-6 ->
/nix/store/nzzdhli6j2m7bbyj1a1cq2g99mz2cwvs-jq-1.5
.nix-gc-roots/dev-shell.drv-6-bin ->
/nix/store/b38jh5lwv42985vymzx3ayj4irz638r0-sqlite-3.14.1-bin
.nix-gc-roots/dev-shell.drv-6-dev ->
/nix/store/kiixbwijnfgb3y46l3avc0rhwl9iqida-sqlite-3.14.1-dev
.nix-gc-roots/dev-shell.drv-7 ->
/nix/store/577a01ii2g1z9qflgc8w8d85ajyfvwvp-nixops-tarball-1.5pre0_abcdef
.nix-gc-roots/dev-shell.drv-8 ->
/nix/store/akbbv847pfxbi31knwypvwi7nfwcbp9m-nixops-1.5pre0_abcdef
.nix-gc-roots/dev-shell.drv-9 ->
/nix/store/w67jiazdf4xyrgs5s0rj5rdxrf92zxil-nss-cacert-3.26

btw, now I see there are duplicate entities, so I guess it is useful to
clean roots before nix-shell run.


> This is basically my experience. The method on the old wiki makes the
> environment survive `nix-channel --update` but not `nix-collect-garbage`
> which is weird because (as in the wiki) I explicitly asked for the .drv
> be a '--indirect --add-root' on $PWD.

I hope there is a way to pin src as GC root, but dumb `buildInputs = [
nixpkgsSrc ];` doesn't work.

2016-10-01 15:49 GMT+00:00 Ruben Astudillo <ruben.astud at gmail.com>:

> On 01/10/16 04:03, Daniel Hlynskyi wrote:
> > To complete previous answer.
> >
> > I create a separate directory .nix-gc-roots, because nix-shell produces
> > many roots.
>
> You do this for keep things in order or because it buys you functionality?
>
> > Also, I haven't found yet a way to get nix root for nixpkgs imported as
> > external derivation, so after garbage collect I still have to
> > redownload some sources
>
> This is basically my experience. The method on the old wiki makes the
> environment survive `nix-channel --update` but not `nix-collect-garbage`
> which is weird because (as in the wiki) I explicitly asked for the .drv
> be a '--indirect --add-root' on $PWD.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20161002/4f4a94f9/attachment.html>


More information about the nix-dev mailing list