@@ -74,6 +74,10 @@ in
7474, hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
7575, enableSeparateDataOutput ? false
7676, enableSeparateDocOutput ? doHaddock
77+, # Don't fail at configure time if there are multiple versions of the
78+ # same package in the (recursive) dependencies of the package being
79+ # built. Will delay failures, if any, to compile time.
80+ allowInconsistentDependencies ? false
7781} @ args:
7882
7983assert editedCabalFile != null -> revision != null;
@@ -336,11 +340,12 @@ stdenv.mkDerivation ({
336340
337341 echo configureFlags: $configureFlags
338342 ${setupCommand} configure $configureFlags 2>&1 | ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log"
339− if ${gnugrep}/bin/egrep -q -z 'Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
340− echo >&2 "*** abort because of serious configure-time warning from Cabal"
341− exit 1
342− fi
343−
343+ ${stdenv.lib.optionalString (!allowInconsistentDependencies) ''
344+ if ${gnugrep}/bin/egrep -q -z 'Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
345+ echo >&2 "*** abort because of serious configure-time warning from Cabal"
346+ exit 1
347+ fi
348+ ''}
344349 export GHC_PACKAGE_PATH="$packageConfDir:"
345350
346351 runHook postConfigure