ghc-with-packages: include only derivations in the generated environment that have a ghc attribute

This predicate filters out packages that weren't created by the Cabal builder.
Doing that greatly reduces the likelihood of file collisions in the generated
environment, because Haskell packages tend to have a lot of propagated build
inputs.

For example, both zeromq 2.x and 3.x use the same names for their header files.
Users of haskell-zeromq don't need those headers, so we just don't include them
in the generated environment to avoid the collision that would otherwise occur
when haskell-zeromq 2.x and 3.x are installed into the same environment.
This commit is contained in:
Peter Simons 2013-03-21 16:25:50 +01:00
parent 0f7c6c7e86
commit 459234db20

View file

@ -10,7 +10,7 @@ let
in
buildEnv {
name = "haskell-env-${ghc.name}";
paths = stdenv.lib.closePropagation (packages ++ [ghc]);
paths = stdenv.lib.filter (x: x ? ghc) (stdenv.lib.closePropagation (packages ++ [ghc]));
postBuild = ''
. ${makeWrapper}/nix-support/setup-hook