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 #