about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2013-11-07 12:02:47 +0100
committerPeter Simons <simons@cryp.to>2013-11-07 12:14:19 +0100
commit89c566fcfd40a82a98d4e674e3aaa6d57d20cceb (patch)
treebfe49249eb3c0adac0bfa4d68fc495bfebb53883 /pkgs/development/compilers
parenta46c71857d99f124cb67dcb287943d138eedf56c (diff)
downloadnixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.tar
nixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.tar.gz
nixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.tar.bz2
nixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.tar.lz
nixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.tar.xz
nixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.tar.zst
nixlib-89c566fcfd40a82a98d4e674e3aaa6d57d20cceb.zip
pkgs/development/compilers/ghc/with-packages.nix: improve recognition of Haskell packages
Haskell packages -- i.e. packages built by our Cabal builder -- invariably have
the attributes 'pname' and 'version'. We use the absence of these attributes to
recognize non-Haskell packages and filter them from the closed package set
generated by closePropagation. We do this so that the generated Haskell
environment won't contain paths like "/lib/libz.a", which are part of the
closure but have nothing to do with Haskell.

The previous scheme used the attribute 'ghc' to accomplish the same thing, but
unfortunately other packages to contain a 'ghc' attribute, too, like the
old-style ghc-wrapper. Including the ghc-wrapper in this environment is
pointless, obviously. The new approach filters the ghc-wrapper successfully.
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ghc/with-packages.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkgs/development/compilers/ghc/with-packages.nix b/pkgs/development/compilers/ghc/with-packages.nix
index b32b12d5b954..8f5e8616a84e 100644
--- a/pkgs/development/compilers/ghc/with-packages.nix
+++ b/pkgs/development/compilers/ghc/with-packages.nix
@@ -7,10 +7,11 @@ let
   packageDBFlag = if ghc761OrLater then "--package-db" else "--package-conf";
   libDir        = "$out/lib/ghc-${ghc.version}";
   packageCfgDir = "${libDir}/package.conf.d";
+  isHaskellPkg  = x: (x ? pname) && (x ? version);
 in
 buildEnv {
   name = "haskell-env-${ghc.name}";
-  paths = stdenv.lib.filter (x: x ? ghc) (stdenv.lib.closePropagation packages) ++ [ghc];
+  paths = stdenv.lib.filter isHaskellPkg (stdenv.lib.closePropagation packages) ++ [ghc];
   postBuild = ''
     . ${makeWrapper}/nix-support/setup-hook