From bdbfe10efbaef3e26926d5741633857d6e5674c3 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sat, 18 Feb 2023 19:18:05 +0100 Subject: [PATCH] haskell.packages.*.cabal-install{,-solver}: unify overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the overrides are practically the same for all but the latest GHC version, we can move the override into configuration-common.nix and rely on a few conditionals in the overlay assembly — and end up with less copying around! --- .../haskell-modules/configuration-common.nix | 25 +++++++++++++++++++ .../configuration-ghc-8.10.x.nix | 15 ----------- .../configuration-ghc-8.8.x.nix | 12 --------- .../configuration-ghc-9.0.x.nix | 12 --------- .../configuration-ghc-9.2.x.nix | 12 --------- 5 files changed, 25 insertions(+), 51 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index abc80f4e3717..bd6a31ae24b2 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -20,6 +20,31 @@ with haskellLib; self: super: { + # cabal-install needs most recent versions of Cabal and Cabal-syntax, + # so we need to put some extra work for non-latest GHCs + inherit ( + let + # !!! Use cself/csuper inside for the actual overrides + cabalInstallOverlay = cself: csuper: + lib.optionalAttrs (lib.versionOlder self.ghc.version "9.4") { + Cabal = cself.Cabal_3_8_1_0; + Cabal-syntax = cself.Cabal-syntax_3_8_1_0; + process = cself.process_1_6_16_0; + } // lib.optionalAttrs (lib.versions.majorMinor self.ghc.version == "8.10") { + # Prevent dependency on doctest which causes an inconsistent dependency + # due to depending on ghc-8.10.7 (with bundled process) vs. process 1.6.16.0 + vector = dontCheck csuper.vector; + }; + in + { + cabal-install = super.cabal-install.overrideScope cabalInstallOverlay; + cabal-install-solver = super.cabal-install-solver.overrideScope cabalInstallOverlay; + } + ) cabal-install + cabal-install-solver + ; + + # There are numerical tests on random data, that may fail occasionally lapack = dontCheck super.lapack; diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix index 8b4439deb0b4..db5e18beef17 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix @@ -48,21 +48,6 @@ self: super: { # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463 xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1; - # cabal-install needs most recent versions of Cabal and Cabal-syntax - cabal-install = super.cabal-install.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - # Prevent dependency on doctest which causes an inconsistent dependency - # due to depending on ghc-8.10.7 (with bundled process) vs. process 1.6.16.0 - vector = dontCheck super.vector; - }); - cabal-install-solver = super.cabal-install-solver.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - # Additionally depends on OneTuple for GHC < 9.0 base-compat-batteries = addBuildDepend self.OneTuple super.base-compat-batteries; diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix index 54ce00760c2c..389bbd308124 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix @@ -54,18 +54,6 @@ self: super: { # This build needs a newer version of Cabal. cabal2spec = super.cabal2spec.override { Cabal = self.Cabal_3_2_1_0; }; - # cabal-install needs most recent versions of Cabal and Cabal-syntax - cabal-install = super.cabal-install.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - cabal-install-solver = super.cabal-install-solver.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - # Additionally depends on OneTuple for GHC < 9.0 base-compat-batteries = addBuildDepend self.OneTuple super.base-compat-batteries; diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix index 7f2ca4a1a5e8..6e347a76db0e 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix @@ -49,18 +49,6 @@ self: super: { # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463 xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1; - # cabal-install needs the latest/matching versions of Cabal-syntax and Cabal - cabal-install = super.cabal-install.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - cabal-install-solver = super.cabal-install-solver.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - # Jailbreaks & Version Updates # This `doJailbreak` can be removed once the following PR is released to Hackage: diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix index 1c72ed517797..9fbeec03e4b5 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix @@ -49,18 +49,6 @@ self: super: { # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463 xhtml = if self.ghc.hasHaddock or true then null else self.xhtml_3000_2_2_1; - # cabal-install needs most recent versions of Cabal and Cabal-syntax - cabal-install = super.cabal-install.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - cabal-install-solver = super.cabal-install-solver.overrideScope (self: super: { - Cabal = self.Cabal_3_8_1_0; - Cabal-syntax = self.Cabal-syntax_3_8_1_0; - process = self.process_1_6_16_0; - }); - # weeder == 2.5.* requires GHC 9.4 weeder = doDistribute self.weeder_2_4_1;