diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2022-05-05 12:01:23 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2022-05-05 12:01:23 -0500 |
commit | 91e4fa278e3095285fc5cb56681a4aff076ca805 (patch) | |
tree | fef210615614e88b7d3c50131c29e4a2634046bd /pkgs/development/haskell-modules/generic-builder.nix | |
parent | 35ddacd8994f90a34cc00db3931a60095b658740 (diff) | |
download | nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.tar nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.tar.gz nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.tar.bz2 nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.tar.lz nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.tar.xz nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.tar.zst nixpkgs-91e4fa278e3095285fc5cb56681a4aff076ca805.zip |
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.
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r-- | pkgs/development/haskell-modules/generic-builder.nix | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index bc43c39676c..e637e446e64 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -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 ''; |