summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/generic-builder.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-21 14:44:46 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-21 15:09:51 -0400
commit900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04 (patch)
tree640e7205fcb98d947ed7413ab861577ec56b3ccf /pkgs/development/haskell-modules/generic-builder.nix
parentc6f742b770924dd1af775714c588f79110e68b30 (diff)
downloadnixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.tar
nixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.tar.gz
nixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.tar.bz2
nixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.tar.lz
nixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.tar.xz
nixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.tar.zst
nixlib-900862ea3bda4ef87dc8b4a8aa78a242d1ae7b04.zip
haskell generic builder: `setupHaskellDepends` should be `nativeBuildInputs
This is because they are just for Setup.hs, so they are just used at build time
and completely isolated from the normal components' dependencies.

This was previous implemented in 8a8f0408cd9b7fdda1095718107c800057658c44, but
reverted in e69c7f56419589c0d3296e81f47032fa813cca4b because it broken
setup-depends non-cross in haskell shell environments (custom Setup.hs in cross
shell environments has never worked). This version adds a special native
exception to avoid that breakage.
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 53974ada8009..42f0facef419 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -169,18 +169,22 @@ let
                         optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
 
   nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
+                      setupHaskellDepends ++
                       buildTools ++ libraryToolDepends ++ executableToolDepends;
   propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
-  otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
+  otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
                      optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
                      optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
                      optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
+
   allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
 
   haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs;
   systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs;
 
-  ghcEnv = ghc.withPackages (p: haskellBuildInputs);
+  # When not cross compiling, also include Setup.hs dependencies.
+  ghcEnv = ghc.withPackages (p:
+    haskellBuildInputs ++ stdenv.lib.optional (!isCross) setupHaskellDepends);
 
   setupCommand = "./Setup";