summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/with-packages-wrapper.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2015-02-22 20:43:40 +0100
committerPeter Simons <simons@cryp.to>2015-02-22 22:13:10 +0100
commitaeadb1644463c8c17e99f4dadb2d86725ea70953 (patch)
tree2f497aa1fc24cab9f56f171dde719be8ed49e307 /pkgs/development/haskell-modules/with-packages-wrapper.nix
parent5d5b51dfc0400bc237e4415a36e6f6d8acbf723b (diff)
downloadnixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.tar
nixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.tar.gz
nixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.tar.bz2
nixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.tar.lz
nixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.tar.xz
nixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.tar.zst
nixlib-aeadb1644463c8c17e99f4dadb2d86725ea70953.zip
ghcWithPackages: don't re-generate the packages.conf.d cache if there are no actual libraries added to the environment
This change resolves https://github.com/NixOS/nixpkgs/issues/6419.
Diffstat (limited to 'pkgs/development/haskell-modules/with-packages-wrapper.nix')
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index 2824296c08fc..763164cec876 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -30,8 +30,8 @@ let
   libDir        = "$out/lib/ghc-${ghc.version}";
   docDir        = "$out/share/doc/ghc/html";
   packageCfgDir = "${libDir}/package.conf.d";
-  isHaskellPkg  = x: (x ? pname) && (x ? version) && (x ? env);
-  paths         = stdenv.lib.filter isHaskellPkg (stdenv.lib.closePropagation packages);
+  paths         = stdenv.lib.filter (x: x ? isHaskellLibrary) (stdenv.lib.closePropagation packages);
+  hasLibraries  = stdenv.lib.any (x: x.isHaskellLibrary) paths;
 in
 if paths == [] then ghc else
 buildEnv {
@@ -73,7 +73,7 @@ buildEnv {
       makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
     done
 
-    $out/bin/ghc-pkg recache
+    ${stdenv.lib.optionalString hasLibraries "$out/bin/ghc-pkg recache"}
     $out/bin/ghc-pkg check
   '';
 } // {