about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-12-15 13:31:08 -0500
committerShea Levy <shea@shealevy.com>2018-12-15 13:31:08 -0500
commit30fb5b0dcf68e94625c48c023e4c7662523f7b24 (patch)
treef62da61975d57ff204952cb63bde285467b3d49b /pkgs/development/haskell-modules
parent562c62039821a276dc342258ec5efef73022fdcf (diff)
downloadnixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.tar
nixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.tar.gz
nixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.tar.bz2
nixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.tar.lz
nixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.tar.xz
nixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.tar.zst
nixlib-30fb5b0dcf68e94625c48c023e4c7662523f7b24.zip
haskell generic builder: Add flag to allow inconsistent dependencies.
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix15
-rw-r--r--pkgs/development/haskell-modules/lib.nix7
2 files changed, 17 insertions, 5 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index a0bf655a67b7..fc2c008be0c8 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -74,6 +74,10 @@ in
 , hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
 , enableSeparateDataOutput ? false
 , enableSeparateDocOutput ? doHaddock
+, # Don't fail at configure time if there are multiple versions of the
+  # same package in the (recursive) dependencies of the package being
+  # built. Will delay failures, if any, to compile time.
+  allowInconsistentDependencies ? false
 } @ args:
 
 assert editedCabalFile != null -> revision != null;
@@ -336,11 +340,12 @@ stdenv.mkDerivation ({
 
     echo configureFlags: $configureFlags
     ${setupCommand} configure $configureFlags 2>&1 | ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log"
-    if ${gnugrep}/bin/egrep -q -z 'Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
-      echo >&2 "*** abort because of serious configure-time warning from Cabal"
-      exit 1
-    fi
-
+    ${stdenv.lib.optionalString (!allowInconsistentDependencies) ''
+      if ${gnugrep}/bin/egrep -q -z 'Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
+        echo >&2 "*** abort because of serious configure-time warning from Cabal"
+        exit 1
+      fi
+    ''}
     export GHC_PACKAGE_PATH="$packageConfDir:"
 
     runHook postConfigure
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index e3b73641989a..9f18db1e6e95 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -408,4 +408,11 @@ rec {
   */
   generateOptparseApplicativeCompletions = commands: pkg:
     pkgs.lib.foldr generateOptparseApplicativeCompletion pkg commands;
+
+  # Don't fail at configure time if there are multiple versions of the
+  # same package in the (recursive) dependencies of the package being
+  # built. Will delay failures, if any, to compile time.
+  allowInconsistentDependencies = drv: overrideCabal drv (drv: {
+    allowInconsistentDependencies = true;
+  });
 }