[Nix-dev] Are nix-shells supposed to nest?

zimbatm zimbatm at zimbatm.com
Mon Feb 15 23:11:04 CET 2016


It's surprising indeed. I would expect nix-shell to always prepend
dependencies to the PATH

~ $ nix-shell -p haskell.compiler.ghc784 --run 'nix-shell -p
haskell.compiler.ghc7103 --run "echo $PATH"'
/nix/store/mvvrh9zadsyxcc5zai88vinl3ylmrlbr-ghc-7.8.4/bin:/nix/store/l15rppxw3fjyysslj160q31jc7pkqb32-patchelf-0.8/bin:/nix/store/5kicd5g9w5fnn10zv6v3f3j63g2r4c72-paxctl-0.9/bin:/nix/store/bkllwvss62hch8vgxacnpdnvmlldwfxn-gcc-wrapper-4.9.3/bin:/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24/bin:/nix/store/6hrcxzwk3padb28i3phnmmz15bjjqaj3-findutils-4.4.2/bin:/nix/store/5pa28il3q8v61zvfx1v3kwgw9g6alv1x-diffutils-3.3/bin:/nix/store/a8md7hpm9drjmdhgla0l3pf7llwdkm31-gnused-4.2.2/bin:/nix/store/dy92hq6ryvaj5bx5c6gi6fvnhyxdh78x-gnugrep-2.22/bin:/nix/store/sfccmsc4fwk11w7blz3g0q2hzi9va8f7-gawk-4.1.3/bin:/nix/store/q26acv90dg3iywdfk2q029ixdr3i19rh-gnutar-1.28/bin:/nix/store/xgz5hs1cvlx4vn98qizpqp8x5gwplqks-gzip-1.6/bin:/nix/store/icv8p8zxwdr6ljxb89vyxrmma7h2iqlh-bzip2-1.0.6/bin:/nix/store/n01xbf2w6x5bvxznmllpz60vx5ylpgjj-gnumake-4.1/bin:/nix/store/pnc8xc1dh3cy4migfipfmzy3ad7snz99-bash-4.3-p42/bin:/nix/store/fgqamjbhxx6d62myqnp62i7b0bka2yiq-patch-2.7.5/bin:/nix/store/dkwhsgc5qa52hbpn3pg9zzz4kqsclzv0-xz-5.2.2/bin:/nix/store/5idnvskkm4hky2fj335xfbqpfim3g9pd-gcc-4.9.3/bin:/nix/store/iyw7cmmg2yi5cwc1pswfm0wrn1ssk1zh-binutils-2.23.1/bin:/nix/store/n2wxp513rr00f6hr2dy0waqahns49dch-glibc-2.21/bin:/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24/bin:/home/zimbatm/bin:/home/zimbatm/.local/bin:/home/zimbatm/.shared/bin:/var/setuid-wrappers:/home/zimbatm/.nix-profile/bin:/home/zimbatm/.nix-profile/sbin:/home/zimbatm/.nix-profile/lib/kde4/libexec:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/nix/var/nix/profiles/default/lib/kde4/libexec:/run/current-system/sw/bin:/run/current-system/sw/sbin:/run/current-system/sw/lib/kde4/libexec:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin


On Mon, 15 Feb 2016 at 20:47 Peter Simons <simons at cryp.to> wrote:

> Hi folks,
>
> the Github issue #13011 [1] asks an interesting question, namely: can we
> nest nix-shell environments? A simple experiment suggests it's possible,
> but the result you get when do you it is quite surprising:
>
>   $ nix-shell -p haskell.compiler.ghc784 --run 'nix-shell -p
> haskell.compiler.ghc7103 --run "ghc --version"'
>   The Glorious Glasgow Haskell Compilation System, version 7.8.4
>
> Apparently, the inner shell ends up being the outer shell in that
> example. So now I wonder: can someone explain why $PATH is set up in
> that example as it is?
>
> And what is our policy with regard to that feature? Can users of
> nix-shell expect nested shells to work in some predictable way? Or is
> that something you're not supposed to do?
>
> Best regards,
> Peter
>
>
> [1] https://github.com/NixOS/nixpkgs/issues/13011
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160215/2045aa24/attachment.html 


More information about the nix-dev mailing list