From 49d835a29f6b4f033aaa2a6fb303bda422e28650 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Mon, 20 Mar 2023 19:02:59 +0100 Subject: [PATCH] haskell.packages.ghc92.cabal-install: get to work The directory >= 1.3.7.0 constraint proved to be a real troublemaker. Since directory is a core package other core packages frequently depend upon (as opposed to process) which tends to cause inconsistent dependency errors. To get it to work the following was done: - Use directory 1.3.7.1 to eliminate the need to also upgrade filepath and unix, saving a bit of trouble. This still forces us to recompile process every time directory is upgraded (i.e. GHC >= 9.2.5) even if the core package process version would match to prevent inconsistent dependencies. - Upgrade hspec to 2.10 where it no longer depends on ghc and ghc-boot-th which naturally causes inconsistent dependencies by depending on core packages, namely directory. --- .../haskell-modules/configuration-common.nix | 32 ++++++++++++++++--- .../configuration-hackage2nix/main.yaml | 1 + .../haskell-modules/hackage-packages.nix | 13 ++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index d513772370ef..b3c0567dfa00 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -45,9 +45,31 @@ self: super: { lib.optionalAttrs (lib.versionOlder self.ghc.version "9.6") { Cabal = cself.Cabal_3_10_1_0; Cabal-syntax = cself.Cabal-syntax_3_10_1_0; - } // lib.optionalAttrs (lib.versionOlder self.ghc.version "9.2.5") { - # GHC 9.2.5 starts shipping 1.6.16.0 + } // lib.optionalAttrs (lib.versionOlder self.ghc.version "9.4") { + # We need at least directory >= 1.3.7.0. Using the latest version + # 1.3.8.* is not an option since it causes very annoying dependencies + # on newer versions of unix and filepath than GHC 9.2 ships + directory = cself.directory_1_3_7_1; + # GHC 9.2.5 starts shipping 1.6.16.0 which is required by + # cabal-install, but we need to recompile process even if the correct + # version is available to prevent inconsistent dependencies: + # process depends on directory. process = cself.process_1_6_17_0; + + # hspec < 2.10 depends on ghc (the library) directly which in turn + # depends on directory, causing a dependency conflict which is practically + # not solvable short of recompiling GHC. Instead of adding + # allowInconsistentDependencies for all reverse dependencies of hspec-core, + # just upgrade to an hspec version without the offending dependency. + hspec-core = cself.hspec-core_2_10_10; + hspec-discover = cself.hspec-discover_2_10_10; + hspec = cself.hspec_2_10_10; + + # hspec-discover and hspec-core depend on hspec-meta for testing which + # we need to avoid since it depends on ghc as well. Since hspec*_2_10* + # are overridden to take the versioned attributes as inputs, we need + # to make sure to override the versioned attribute with this fix. + hspec-discover_2_10_10 = dontCheck csuper.hspec-discover_2_10_10; } // 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 @@ -1571,9 +1593,11 @@ self: super: { hspec-discover_2_10_10 = doDistribute (super.hspec-discover_2_10_10.override { hspec-meta = self.hspec-meta_2_10_5; }); - hspec-core_2_10_10 = doDistribute (super.hspec-core_2_10_10.override { + # Need to disable tests to prevent an infinite recursion if hspec-core_2_10_10 + # is overlayed to hspec-core. + hspec-core_2_10_10 = doDistribute (dontCheck (super.hspec-core_2_10_10.override { hspec-meta = self.hspec-meta_2_10_5; - }); + })); # Point hspec 2.7.10 to correct dependencies hspec_2_7_10 = super.hspec_2_7_10.override { diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml index 30d67e6aa747..7f78ffcfed63 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml @@ -53,6 +53,7 @@ extra-packages: - Cabal == 3.6.* - Cabal-syntax == 3.8.* # required for cabal-install{,-parsers} - Cabal == 3.8.* # required for cabal-install{,-parsers} + - directory == 1.3.7.* # required to build cabal-install 3.10.* with GHC 9.2 - Diff < 0.4 # required by liquidhaskell-0.8.10.2: https://github.com/ucsd-progsys/liquidhaskell/issues/1729 - aeson < 2 # required by pantry-0.5.2 - apply-refact == 0.9.* # 2022-12-12: needed for GHC < 9.2 diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix index d9fb4704e05a..afa6220b96f9 100644 --- a/pkgs/development/haskell-modules/hackage-packages.nix +++ b/pkgs/development/haskell-modules/hackage-packages.nix @@ -82715,6 +82715,19 @@ self: { broken = true; }) {}; + "directory_1_3_7_1" = callPackage + ({ mkDerivation, base, filepath, time, unix }: + mkDerivation { + pname = "directory"; + version = "1.3.7.1"; + sha256 = "1z8frwbr0kdk47x3xasq7ifzcrwl7ryh1aqgf202xv4cakb8a9yw"; + libraryHaskellDepends = [ base filepath time unix ]; + testHaskellDepends = [ base filepath time unix ]; + description = "Platform-agnostic library for filesystem operations"; + license = lib.licenses.bsd3; + hydraPlatforms = lib.platforms.none; + }) {}; + "directory_1_3_8_1" = callPackage ({ mkDerivation, base, filepath, time, unix }: mkDerivation {