From 934737b1ecaedfe07e7d687e1de545ea257369e4 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 10 Mar 2026 23:02:45 +0100 Subject: [PATCH 1/4] haskell.packages.ghc9123.fourmolu: fix missing executable in tests Cabal >= 3.14 prepends dist/build/ to PATH, but sometimes with a relative path which causes problems if the test suite changes directory which fourmolu's does. --- .../development/haskell-modules/configuration-common.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 3d9c2a46e8b3..7a7631aa18f0 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -220,6 +220,15 @@ with haskellLib; lib.mapAttrs (_: pkg: pkg.overrideScope hls_overlay) ( super // { + # Work around test suite not finding executable due to https://github.com/haskell/cabal/issues/11598 + fourmolu = appendPatches [ + (pkgs.fetchpatch { + name = "fourmolu-absolute-build-tool-paths.patch"; + url = "https://github.com/fourmolu/fourmolu/commit/9217bc926ab80d20b815f0486be2184db07df4fc.patch"; + hash = "sha256-ANzuKy5WfWCGZ7HFVBpTtuyUqzFfef/xR/v1KiyJEX4="; + }) + ] super.fourmolu; + # HLS 2.11: Too strict bound on Diff 1.0. haskell-language-server = lib.pipe super.haskell-language-server [ dontCheck From ebd59d461079093a8c6c223d9f663dd608531bc1 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 10 Mar 2026 23:04:23 +0100 Subject: [PATCH 2/4] haskell.packages.ghc9123.cabal-add: fix missing executable in tests Cabal >= 3.14 prepends dist/build/ to PATH, but sometimes with a relative path which causes problems if the test suite changes directory which cabal-add's does. --- .../development/haskell-modules/configuration-common.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 7a7631aa18f0..6132d443f222 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -260,6 +260,15 @@ with haskellLib; disableCabalFlag "auto" super.ghc-lib-parser-ex ); + # Work around test suite not finding executable due to https://github.com/haskell/cabal/issues/11598 + cabal-add = appendPatches [ + (pkgs.fetchpatch { + name = "cabal-add-absolute-build-tool-paths.patch"; + url = "https://github.com/Bodigrim/cabal-add/commit/3b94b0175c294c2d0a30b6d8da3f56189216816c.patch"; + hash = "sha256-4Nbro9Gl+RC78yprO8fYG/IWS7QvJPd0dKqSZb5jq9k="; + }) + ] super.cabal-add; + ########################################### ### END HASKELL-LANGUAGE-SERVER SECTION ### ########################################### From eb4dcd05a562702824d87a671d255ad917d1caa6 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 10 Mar 2026 23:04:51 +0100 Subject: [PATCH 3/4] haskellPackages.{cabal-add,fourmolu}: don't unnecessarily add prog to PATH cabal-add and fourmolu (ab)use build-tool-depends in order to have the package's executable in PATH during test suite _execution_. This feature was introduced in Cabal 3.14, so we can stop modifying PATH for GHC >= 9.12. --- .../haskell-modules/configuration-nix.nix | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index cb6cd01b488b..faf97a886547 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -56,10 +56,18 @@ builtins.intersectAttrs super { ### HASKELL-LANGUAGE-SERVER SECTION ### ####################################### - cabal-add = overrideCabal (drv: { - # tests depend on executable - preCheck = ''export PATH="$PWD/dist/build/cabal-add:$PATH"''; - }) super.cabal-add; + cabal-add = + # Can't find executable without https://github.com/haskell/cabal/pull/9912 + if lib.versionOlder self.ghc.version "9.12" then + overrideCabal (drv: { + # tests depend on executable + preCheck = '' + ${drv.preCheck or ""} + export PATH="$PWD/dist/build/cabal-add:$PATH" + ''; + }) super.cabal-add + else + super.cabal-add; haskell-language-server = overrideCabal (drv: { # starting with 1.6.1.1 haskell-language-server wants to be linked dynamically @@ -1817,11 +1825,16 @@ builtins.intersectAttrs super { inherit ( let - fourmoluTestFix = overrideCabal (drv: { - preCheck = drv.preCheck or "" + '' - export PATH="$PWD/dist/build/fourmolu:$PATH" - ''; - }); + fourmoluTestFix = + # Can't find executable without https://github.com/haskell/cabal/pull/9912 + if lib.versionOlder self.ghc.version "9.12" then + overrideCabal (drv: { + preCheck = drv.preCheck or "" + '' + export PATH="$PWD/dist/build/fourmolu:$PATH" + ''; + }) + else + lib.id; in builtins.mapAttrs (_: fourmoluTestFix) super ) From 5e74d3ca0ed98be26146f7e13e12a4eac4c7312e Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 25 Feb 2026 13:53:07 +0100 Subject: [PATCH 4/4] haskell.compiler.ghc912: 9.12.2 -> 9.12.3 After #490755, the problematic regression has been patched, so we can actually update. After the fixes for fourmolu and cabal-add, HLS can also be built with GHC 9.12.3. --- pkgs/top-level/haskell-packages.nix | 2 +- pkgs/top-level/release-haskell.nix | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 949915974dd0..b64005040f85 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -66,7 +66,7 @@ let ghc96 = sets.ghc967; ghc98 = sets.ghc984; ghc910 = sets.ghc9103; - ghc912 = sets.ghc9122; + ghc912 = sets.ghc9123; ghc914 = sets.ghc9141; }; in diff --git a/pkgs/top-level/release-haskell.nix b/pkgs/top-level/release-haskell.nix index 54037b97aa98..a92414094165 100644 --- a/pkgs/top-level/release-haskell.nix +++ b/pkgs/top-level/release-haskell.nix @@ -67,7 +67,6 @@ let ghc967 ghc984 ghc9103 - ghc9122 # TODO(@sternenseemann): drop ghc9123 ]; @@ -526,7 +525,6 @@ let ] released; Cabal_3_10_3_0 = lib.subtractLists [ # time < 1.13 conflicts with time == 1.14.* - compilerNames.ghc9122 compilerNames.ghc9123 ] released; Cabal_3_12_1_0 = released; @@ -538,7 +536,6 @@ let haskell-language-server = released; hoogle = released; hlint = lib.subtractLists [ - compilerNames.ghc9122 compilerNames.ghc9123 ] released; hpack = released; @@ -551,11 +548,9 @@ let ghc-lib-parser = released; ghc-lib-parser-ex = released; ghc-source-gen = lib.subtractLists [ - compilerNames.ghc9122 compilerNames.ghc9123 ] released; ghc-tags = lib.subtractLists [ - compilerNames.ghc9122 compilerNames.ghc9123 ] released; hashable = released; @@ -566,7 +561,6 @@ let compilerNames.ghc967 ]; weeder = lib.subtractLists [ - compilerNames.ghc9122 compilerNames.ghc9123 ] released; })