haskellPackages.mkDerivation: don't ev allPkgconfigDepends too early

Just getting the length of allPkgconfigDepends now may require a quite
expensive and involved function to be execute, so it should be put off
as long as possible. We can achieve this by moving the assert for
pkg-config being available next to its inclusion in nativeBuildInputs.

This solves the infinite recursion triggered by hercules-ci-cnix-store.
This commit is contained in:
sternenseemann 2023-07-29 22:13:40 +02:00
parent a83158c7b9
commit 69b514d249

View file

@ -300,7 +300,7 @@ let
optionals doCheck testToolDepends ++ optionals doCheck testToolDepends ++
optionals doBenchmark benchmarkToolDepends; optionals doBenchmark benchmarkToolDepends;
nativeBuildInputs = nativeBuildInputs =
[ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkg-config ++ [ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) (assert pkg-config != null; pkg-config) ++
setupHaskellDepends ++ collectedToolDepends; setupHaskellDepends ++ collectedToolDepends;
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryFrameworkDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryFrameworkDepends;
otherBuildInputsHaskell = otherBuildInputsHaskell =
@ -349,8 +349,6 @@ let
intermediatesDir = "share/haskell/${ghc.version}/${pname}-${version}/dist"; intermediatesDir = "share/haskell/${ghc.version}/${pname}-${version}/dist";
in lib.fix (drv: in lib.fix (drv:
assert allPkgconfigDepends != [] -> pkg-config != null;
stdenv.mkDerivation ({ stdenv.mkDerivation ({
inherit pname version; inherit pname version;