haskell-generic-builder: simplify "package.conf.d" management

The builder creates a temporary package.conf.d database in $TMP that
contains everything required to build the current package (i.e. the
transitive closure of the package's propagated build inputs). These
files are no longer installed, however, we just install the package.conf
file for the package we're actually building. This means that
package.conf.d directory in $out won't have collisions anymore, which
simplifies the with-packages-wrapper.nix a bit.
This commit is contained in:
Peter Simons
2015-01-10 15:55:47 +01:00
parent fa27f2af5b
commit afca6145d4
2 changed files with 83 additions and 68 deletions
@@ -31,11 +31,12 @@ let
docDir = "$out/share/doc/ghc/html";
packageCfgDir = "${libDir}/package.conf.d";
isHaskellPkg = x: (x ? pname) && (x ? version);
paths = stdenv.lib.filter isHaskellPkg (stdenv.lib.closePropagation packages);
in
if packages == [] then ghc else
stdenv.lib.addPassthru (buildEnv {
if paths == [] then ghc else
buildEnv {
inherit (ghc) name;
paths = stdenv.lib.filter isHaskellPkg (stdenv.lib.closePropagation packages) ++ [ghc];
paths = paths ++ [ghc];
inherit ignoreCollisions;
postBuild = ''
. ${makeWrapper}/nix-support/setup-hook
@@ -72,15 +73,10 @@ stdenv.lib.addPassthru (buildEnv {
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
done
rm $out/lib/${ghc.name}/package.conf.d
mkdir $out/lib/${ghc.name}/package.conf.d
for pkg in $paths; do
for file in "$pkg/nix-support/${ghc.name}-package.conf.d/"*.conf "$pkg/lib/${ghc.name}/package.conf.d/"*.conf; do
ln -sf $file $out/lib/${ghc.name}/package.conf.d/
done
done
$out/bin/ghc-pkg recache
$out/bin/ghc-pkg check
'';
}) { inherit (ghc) version; }
} // {
preferLocalBuild = true;
inherit (ghc) version meta;
}