[Nix-dev] use cabal2nix to create local nix environment for packages that aren't in nixpkgs

Benno Fünfstück benno.fuenfstueck at gmail.com
Tue Dec 2 18:28:08 CET 2014


Hi Dennis,

The problem here is that `haddock` can't guess where it should find the
packages (all packages are in /nix/store/<somehash>-...). GHC only works
because the nix cabal builder takes special care to use a wrapped GHC that
also looks in PATH (replacing /bin with /lib/ghc-$ver/, which is kind of a
hack IMO) for packages. But haddock isn't wrapped, so it doesn't find the
packages.

The solution is to set the GHC_PACKAGE_PATH environment variable to point
to the packages. The nix cabal builder does that at the end of the build
phase. So, if you do

    $ eval "$configurePhase"  # The nix cabal builder has it's own
configure phase, which doesn't use cabal-install but only Cabal
    $ eval "$buildPhase"

then haddock should work after that, because eval "$buildPhase" will set
GHC_PACKAGE_PATH. The only problem with that is that you can't use `cabal
configure` anymore, since cabal doesn't support GHC_PACKAGE_PATH. So if you
ever need to run `cabal configure` again, you have to unset that
environment variable again and re-run the above steps.

Benno

John Wiegley <johnw at newartisans.com> schrieb am Tue Dec 02 2014 at 18:09:26:

>>>>> cdep illabout at gmail com <cdep.illabout at gmail.com> writes:
>
> > I posted the following question on Stackoverflow, but I received no
> > responses, so I thought this list might be more appropriate.
>
> Btw, I've been using the following two scripts to great success in my
> local haskell work:
>
>
> They will each create the necessary files if they are missing, and then do
> what you expect to be done.
>
> John
> _______________________________________________
> 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/20141202/b4a74e24/attachment.html 


More information about the nix-dev mailing list