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

Daniel Bergey bergey at alum.mit.edu
Fri Mar 6 16:05:26 CET 2015


On 2015-03-06 at 13:24, Michael Alan Dorman <mdorman at jaunder.io> wrote:
> In developing a haskell library, I would like to be able to maintain
> both a default.nix (that represents the library dependencies, etc.), and
> then have a shell.nix that adds things to it in order to build a
> development environment---specifically some build tools, hasktags,
> hlint, etc.

Fortunately, this is easy to do.  Put the output of `cabal2nix .` in
`default.nix`.  `cabal2nix --shell .` inlines the output of the previous
command.  If you instead `callPackage` the `default.nix`, you're most of
the way there.

I have a slightly more elaborate example in [1].  It adds build tools,
and provides convenient places to add version pins or pick a GHC
version.  I imagine others have their own variations.

Daniel

Footnotes: 
[1]  https://github.com/bergey/nix-config/blob/master/bash_aliases#L49



More information about the nix-dev mailing list