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.
This commit is contained in:
parent
5d5b51dfc0
commit
aeadb16444
@ -30,8 +30,8 @@ let
|
|||||||
libDir = "$out/lib/ghc-${ghc.version}";
|
libDir = "$out/lib/ghc-${ghc.version}";
|
||||||
docDir = "$out/share/doc/ghc/html";
|
docDir = "$out/share/doc/ghc/html";
|
||||||
packageCfgDir = "${libDir}/package.conf.d";
|
packageCfgDir = "${libDir}/package.conf.d";
|
||||||
isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
|
paths = stdenv.lib.filter (x: x ? isHaskellLibrary) (stdenv.lib.closePropagation packages);
|
||||||
paths = stdenv.lib.filter isHaskellPkg (stdenv.lib.closePropagation packages);
|
hasLibraries = stdenv.lib.any (x: x.isHaskellLibrary) paths;
|
||||||
in
|
in
|
||||||
if paths == [] then ghc else
|
if paths == [] then ghc else
|
||||||
buildEnv {
|
buildEnv {
|
||||||
@ -73,7 +73,7 @@ buildEnv {
|
|||||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
||||||
done
|
done
|
||||||
|
|
||||||
$out/bin/ghc-pkg recache
|
${stdenv.lib.optionalString hasLibraries "$out/bin/ghc-pkg recache"}
|
||||||
$out/bin/ghc-pkg check
|
$out/bin/ghc-pkg check
|
||||||
'';
|
'';
|
||||||
} // {
|
} // {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user