mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-01 01:33:20 +00:00
haskell-modules/generic-builder.nix: use mktemp instead of TMPDIR
Using $TMPDIR here is problematic because it is not always cleared at the end of each build, for instance when using "nix-shell --run genericBuild". This can cause confusing errors when a nix-shell build is trying to pull in dependencies from a previous build since it tries to use older package conf files. To fix, we can just use mktemp which will guarantee us a clean directory for each build. Should have no effect in nix-build, but will fix a common issue with using generic-builder in nix-shell.
This commit is contained in:
parent
35ddacd899
commit
91e4fa278e
@ -338,9 +338,10 @@ stdenv.mkDerivation ({
|
||||
echo "Build with ${ghc}."
|
||||
${optionalString (isLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
|
||||
|
||||
setupPackageConfDir="$TMPDIR/setup-package.conf.d"
|
||||
builddir="$(mktemp -d)"
|
||||
setupPackageConfDir="$builddir/setup-package.conf.d"
|
||||
mkdir -p $setupPackageConfDir
|
||||
packageConfDir="$TMPDIR/package.conf.d"
|
||||
packageConfDir="$builddir/package.conf.d"
|
||||
mkdir -p $packageConfDir
|
||||
|
||||
setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
|
||||
@ -418,7 +419,7 @@ stdenv.mkDerivation ({
|
||||
done
|
||||
|
||||
echo setupCompileFlags: $setupCompileFlags
|
||||
${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
||||
${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $builddir -hidir $builddir $i
|
||||
|
||||
runHook postCompileBuildDriver
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user