[Nix-dev] How to add tools to a nix-shell environment for haskell development?

Michael Alan Dorman mdorman at jaunder.io
Sat Mar 7 13:43:51 CET 2015


Hi, Peter,

On Fri, Mar 6, 2015, at 07:42 AM, Peter Simons wrote:
> why don't you just add those tools into your user's profile?

That's a reasonable question, with two answers:

The short answer is that the examples I gave weren't the best, they were
just what sorted first in my list of Haskell development tools---the
ones I believe must be instantiated in that environment in order to work
correctly are ghc-mod and hoogle, though I may need to add an additional
wrapper somewhere to get a functioning hoogle.

Or I might not, which is the segue to my second answer:

I am actually uncertain that things will work properly if I just include
them in my user profile.  I mean, yeah, they seem to work in simple
cases, but so does taffybar---until you configure it, at which point you
find out that you really need to add that to your environment using
ghcWithPackages, because otherwise it can't recompile itself.  So I find
myself taking a defensive posture regarding other haskell tools.

I understand that NixOS presents a very different vision of the OS to
tools that make various presumptions, which require various strategies
to rectify---and I understand that there's always going to be some
costs, but if the benefits outweigh them, I'm willing to bear them.  I
have spent years trying to maintain this sort of deterministic
build-and-configuration setup on top of Debian, and a facsimile can
largely be achieved, but it is a lot of work.

Still, trying to realize those benefits has been elusive:

 * the documentation about how to resolve some of these things is
 scattered around,
 * much of the haskell documentation seems out of date in various ways
 (not addressing haskell-ng, referencing apparently-deprecated things
 like myEnvFun, etc),
 * much of the documentation that's not out of date presumes significant
 familiarity with nix and/or how things used to be done.
 * common uses cases in other environments seem unaddressed (presuming
 I'm going to run my editor inside each different nix-shell environment
 is very un-emacs)
 * you also get to learn not just a new language, but a complex,
 intertwingled system of software management

Looking at this, perhaps the contribution I can attempt is to try and
turn my experiences into something of a guide for this, though it's not
something I would trust myself to do solo, because, well, I'm still at
the madly-flailing stage.

Mike.


More information about the nix-dev mailing list