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.
This commit is contained in:
sternenseemann
2026-03-10 23:08:34 +01:00
parent ebd59d4610
commit eb4dcd05a5
@@ -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
)