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