about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2018-09-17 23:11:59 +0200
committerPeter Simons <simons@cryp.to>2018-10-03 18:00:29 +0200
commit7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4 (patch)
treea3b3d1befe79af28d866cc9fa88260c866248e5e /pkgs/development/haskell-modules
parent1951aea6a5b127a7a398784e4bb26746d01c157c (diff)
downloadnixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.tar
nixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.tar.gz
nixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.tar.bz2
nixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.tar.lz
nixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.tar.xz
nixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.tar.zst
nixlib-7c5c3fceff06ecadf21297d2b5cbed4e7e6168b4.zip
haskell.lib.getBuildInputs: Use generic builder passthru to implement
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix15
-rw-r--r--pkgs/development/haskell-modules/lib.nix56
2 files changed, 13 insertions, 58 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 648ee4b6b9b6..8dea5d0493b3 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -174,8 +174,7 @@ let
     (optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
   ];
 
-  isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
-  isSystemPkg = x: !isHaskellPkg x;
+  isHaskellPkg = x: x ? isHaskellLibrary;
 
   allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
                         optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
@@ -192,7 +191,10 @@ let
                      optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testFrameworkDepends) ++
                      optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkFrameworkDepends);
 
-  allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
+
+  allBuildInputs = propagatedBuildInputs ++ otherBuildInputs ++ depsBuildBuild;
+  isHaskellPartition =
+    stdenv.lib.partition isHaskellPkg allBuildInputs;
 
   haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs;
   systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs;
@@ -429,6 +431,13 @@ stdenv.mkDerivation ({
 
     compiler = ghc;
 
+
+    getBuildInputs = {
+      inherit propagatedBuildInputs otherBuildInputs allPkgconfigDepends;
+      haskellBuildInputs = isHaskellPartition.right;
+      systemBuildInputs = isHaskellPartition.wrong;
+    };
+
     isHaskellLibrary = isLibrary;
 
     # TODO: ask why the split outputs are configurable at all?
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index 8dae7c8d72c0..6155e158e9de 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -299,12 +299,7 @@ rec {
     overrideCabal drv (_: { inherit src version; editedCabalFile = null; });
 
   # Get all of the build inputs of a haskell package, divided by category.
-  getBuildInputs = p:
-    (overrideCabal p (args: {
-      passthru = (args.passthru or {}) // {
-        _getBuildInputs = extractBuildInputs p.compiler args;
-      };
-    }))._getBuildInputs;
+  getBuildInputs = p: p.getBuildInputs;
 
   # Extract the haskell build inputs of a haskell package.
   # This is useful to build environments for developing on that
@@ -339,55 +334,6 @@ rec {
                   , ...
                   }: { inherit doCheck doBenchmark; };
 
-  # Divide the build inputs of the package into useful sets.
-  extractBuildInputs = ghc:
-    { setupHaskellDepends ? [], extraLibraries ? []
-    , librarySystemDepends ? [], executableSystemDepends ? []
-    , pkgconfigDepends ? [], libraryPkgconfigDepends ? []
-    , executablePkgconfigDepends ? [], testPkgconfigDepends ? []
-    , benchmarkPkgconfigDepends ? [], testDepends ? []
-    , testHaskellDepends ? [], testSystemDepends ? []
-    , testToolDepends ? [], benchmarkDepends ? []
-    , benchmarkHaskellDepends ? [], benchmarkSystemDepends ? []
-    , benchmarkToolDepends ? [], buildDepends ? []
-    , libraryHaskellDepends ? [], executableHaskellDepends ? []
-    , ...
-    }@args:
-    let inherit (ghcInfo ghc) isGhcjs nativeGhc;
-        inherit (controlPhases ghc args) doCheck doBenchmark;
-        isHaskellPkg = x: x ? isHaskellLibrary;
-        allPkgconfigDepends =
-          pkgconfigDepends ++ libraryPkgconfigDepends ++
-          executablePkgconfigDepends ++
-          lib.optionals doCheck testPkgconfigDepends ++
-          lib.optionals doBenchmark benchmarkPkgconfigDepends;
-        otherBuildInputs =
-          setupHaskellDepends ++ extraLibraries ++
-          librarySystemDepends ++ executableSystemDepends ++
-          allPkgconfigDepends ++
-          lib.optionals doCheck ( testDepends ++ testHaskellDepends ++
-                                  testSystemDepends ++ testToolDepends
-                                ) ++
-          # ghcjs's hsc2hs calls out to the native hsc2hs
-          lib.optional isGhcjs nativeGhc ++
-          lib.optionals doBenchmark ( benchmarkDepends ++
-                                      benchmarkHaskellDepends ++
-                                      benchmarkSystemDepends ++
-                                      benchmarkToolDepends
-                                    );
-        propagatedBuildInputs =
-          buildDepends ++ libraryHaskellDepends ++
-          executableHaskellDepends;
-        allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
-        isHaskellPartition =
-          lib.partition isHaskellPkg allBuildInputs;
-    in
-      { haskellBuildInputs = isHaskellPartition.right;
-        systemBuildInputs = isHaskellPartition.wrong;
-        inherit propagatedBuildInputs otherBuildInputs
-          allPkgconfigDepends;
-      };
-
   # Utility to convert a directory full of `cabal2nix`-generated files into a
   # package override set
   #