[Nix-dev] nix-shell pro/con (was: Python 3 as default)

Andreas Herrmann andreash87 at gmx.ch
Thu Feb 16 07:50:33 CET 2017


On Wednesday 15 February 2017 22:08:26 Profpatsch wrote:
> On 17-02-15 09:10pm, Ricardo M. Correia wrote:
> > Personally, I try to avoid using "nix-shell" as much as possible because I
> > want "nixos-rebuild switch" to atomically install (and upgrade) all the
> > software that I usually need, including development packages.
> > 
> > With nix-shell, I risk having the packages I need become outdated (without
> > me noticing) and/or become garbage collected (which I do every day
> > automatically) and unavailable if I lose Internet access (e.g. because I'm
> > traveling).
>
> packages being not cached is a largely orthogonal problem;
> for example it would be quite easy to create a script that fetches
> the nix-shell deps for all your projects and creates a folder with
> gc-roots.

I've written such a script a while ago:
https://gist.github.com/aherrmann/51b56283f9ed5853747908fbab907316

It places the gcroots in separate folders under `~/.nix-shell`.
If you run it as `pnix-shell -c` it will reevaluate the Nix expression.
This way you can enforce updates.


More information about the nix-dev mailing list