summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2014-11-06 14:05:44 +0100
committerPeter Simons <simons@cryp.to>2014-11-07 23:22:25 +0100
commit40bb2781eeb73ec01d167d96c810f43deb240a7e (patch)
treea5e06b9df88b8e25630163af3f9bf1bf8eab71a9 /pkgs/build-support
parentd3bcc4ac981b3adf55d9047f1f1f8d453d0ad923 (diff)
downloadnixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.tar
nixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.tar.gz
nixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.tar.bz2
nixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.tar.lz
nixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.tar.xz
nixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.tar.zst
nixlib-40bb2781eeb73ec01d167d96c810f43deb240a7e.zip
cabal: add "-hidir $TMPDIR" parameter to ghc call that compiles Setup.hs
Packages that don't have a Setup.hs file get to use a default version that
lives in the Nix store. By default ghc tries to put the Setup.o and Setup.hi
files in the same directory as the source file, which isn't writable. This
leads to build errors [1]. Thus, we re-direct those paths to a build-local
writable location: $TMPDIR.

Arguably, we could also use "." or copy the /nix/store/deadbeef-Setup.hs file
into the local source directory before compiling, which would work fine, too.

[1] https://github.com/NixOS/nixpkgs/issues/4851
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cabal/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 3fa833876921..e9a8a50774c9 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -194,7 +194,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
               for i in Setup.hs Setup.lhs ${defaultSetupHs}; do
                 test -f $i && break
               done
-              ghc --make -o Setup -odir $TMPDIR $i
+              ghc --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
 
               for p in $extraBuildInputs $propagatedNativeBuildInputs; do
                 if [ -d "$p/lib/ghc-${ghc.ghc.version}/package.conf.d" ]; then