Skip to content

Commit

Permalink
generic-builder: use buildInputs for Haskell dependencies
Browse files Browse the repository at this point in the history
This actually will matter when I (soon) land cross-compilation support,
and native deps are compiled for the build, instead of host, platform.
But even now, it's good style do this, and one less thing to review
later.

The use of `$nativePkgs` is unfortunate, as it will need to be
swapped out for `$crossPkgs` for build != host builds. This will just a
temporarily cause pain, however, as eventually I will change stdenv to
use a `$runPkgs` (or moral equivalent) in both case.

Closes NixOS#26480.
  • Loading branch information
Ericson2314 authored and peti committed Jun 16, 2017
1 parent 7bcfdc1 commit 8a8f040
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkgs/development/haskell-modules/generic-builder.nix
Expand Up @@ -144,9 +144,9 @@ let
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends;

nativeBuildInputs = setupHaskellDepends ++ buildTools ++ libraryToolDepends ++ executableToolDepends;
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ setupHaskellDepends ++
buildTools ++ libraryToolDepends ++ executableToolDepends ++
otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
# ghcjs's hsc2hs calls out to the native hsc2hs
Expand Down Expand Up @@ -181,8 +181,9 @@ stdenv.mkDerivation ({

inherit src;

nativeBuildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs;
propagatedNativeBuildInputs = optionals hasActiveLibrary propagatedBuildInputs;
inherit nativeBuildInputs;
buildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs;
propagatedBuildInputs = optionals hasActiveLibrary propagatedBuildInputs;

LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.

Expand All @@ -209,11 +210,8 @@ stdenv.mkDerivation ({
setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
local inputClosure=""
for i in $propagatedNativeBuildInputs $nativeBuildInputs; do
findInputs $i inputClosure propagated-native-build-inputs
done
for p in $inputClosure; do
# nativePkgs defined in stdenv/setup.hs
for p in $nativePkgs; do
if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then
cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/
continue
Expand Down

0 comments on commit 8a8f040

Please sign in to comment.