I’ve seen examples of nix-shell environments, sometimes based on buildEnv
, sometimes on mkShell
; are there some important differences? Which one should I use and why?
5 Likes
Let’s first take a look at buildEnv
:
This is basically a wrapper around the builder.pl
, and simply provides you with a bunch of symlinks. I’m not sure why you’d use it for a nix-shell
, but it seems like some people like to put all their buildInputs
through buildEnv
to get a reference to all their dependencies within a single directory.
mkShell
This one is super simple compared to buildEnv
and the one I use every day, all it does is provide some defaults for a stdenv.mkDerivation
. So you don’t need to give it a src
or name
, all you really need is buildInputs
, maybe a shellHook
that runs when you enter the nix-shell
, and any env variables you want.
8 Likes
See also Nixpkgs issue 58624, " mkShell needs more documentation in the manual" for more info.