haskellPackages.mkDerivation: allow overriding automatic propagation

Since we can't reliably (or easily at least) tell what Cabal version is
used, we should allow overriding whether to propagate or not, although
GHC >= 9.3 is correct in most cases.
This commit is contained in:
sternenseemann 2023-08-07 17:29:30 +02:00
parent 88f2062797
commit 2e876061cc

View file

@ -98,14 +98,21 @@ in
# build products from that prior build as a starting point for accelerating # build products from that prior build as a starting point for accelerating
# this build # this build
, previousIntermediates ? null , previousIntermediates ? null
, # For GHC >= 9.4 we currently automatically propagate the dependencies of , # Cabal 3.8 which is shipped by default for GHC >= 9.3 always calls
# allPkgconfigDepends to be direct dependencies to allow Cabal >= 3.8 # `pkg-config --libs --static` as part of the configure step. This requires
# to call `pkg-config --libs --static` (https://github.com/haskell/cabal/issues/8455). # Requires.private dependencies of pkg-config dependencies to be present in
# This can easily lead to the argv limit being exceeded in linker or C compiler # PKG_CONFIG_PATH which is normally not the case in nixpkgs (except in pkgsStatic).
# invocations. To work around this we can only propagate derivations that are # Since there is no patch or upstream patch yet, we replicate the automatic
# known to provide pkg-config modules, as indicated by the presence of # propagation of dependencies in pkgsStatic for allPkgConfigDepends for
# `meta.pkgConfigModules`. This option defaults to false for now, since this # GHC >= 9.3 by default. This option allows overriding this behavior manually
# metadata is far from complete in nixpkgs. # if mismatching Cabal and GHC versions are used.
# See also <https://github.com/haskell/cabal/issues/8455>.
__propagatePkgConfigDepends ? lib.versionAtLeast ghc.version "9.3"
, # Propagation can easily lead to the argv limit being exceeded in linker or C
# compiler invocations. To work around this we can only propagate derivations
# that are known to provide pkg-config modules, as indicated by the presence
# of `meta.pkgConfigModules`. This option defaults to false for now, since
# this metadata is far from complete in nixpkgs.
__onlyPropagateKnownPkgConfigModules ? false __onlyPropagateKnownPkgConfigModules ? false
} @ args: } @ args:
@ -300,7 +307,7 @@ let
); );
in in
if lib.versionAtLeast ghc.version "9.3" if __propagatePkgConfigDepends
then propagatePlainBuildInputs allPkgconfigDepends' then propagatePlainBuildInputs allPkgconfigDepends'
else allPkgconfigDepends'; else allPkgconfigDepends';
allPkgconfigDepends' = allPkgconfigDepends' =