From f94cecf640664fd9dd3bbc6cc38b216a5551825a Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 23 Jun 2026 14:18:49 +0200 Subject: [PATCH 1/3] haskell.packages.ghc910.stack: remove compat code Ideally, we won't use this going forward and just build stack with GHC 9.12 --- .../configuration-ghc-9.10.x.nix | 45 ------------------- 1 file changed, 45 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix index 24cb5648c3ca..98800be59996 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.10.x.nix @@ -75,51 +75,6 @@ in # “Unfortunately we are unable to support GHC 9.10.” apply-refact = dontDistribute (markBroken super.apply-refact); - stack = - # Setup.hs depends on Cabal-syntax >= 3.14 - overrideCabal - (drv: { - setupHaskellDepends = drv.setupHaskellDepends or [ ] ++ [ - self.Cabal-syntax_3_14_2_0 - self.Cabal_3_14_2_0 - ]; - # We need to tell GHC to ignore the Cabal core libraries while - # compiling Setup.hs since it depends on Cabal >= 3.14. - # ATTN: This override assumes we are using GHC 9.10.3 since we need - # to give an exact Cabal version at the GHC (!) command line. - # FIXME(@sternenseemann): make direct argument to generic-builder.nix - env = drv.env or { } // { - setupCompileFlags = lib.concatStringsSep " " [ - "-hide-package" - "Cabal-syntax-3.12.1.0" - "-hide-package" - "Cabal-3.12.1.0" - ]; - }; - }) - - # Stack itself depends on Cabal >= 3.14 which also needs to be updated for deps - ( - super.stack.overrideScope ( - sself: ssuper: - let - upgradeCabal = - drv: - lib.pipe drv [ - (addBuildDepends [ sself.Cabal_3_14_2_0 ]) - (appendConfigureFlags [ "--constraint=Cabal>=3.14" ]) - ]; - in - { - pantry = upgradeCabal ssuper.pantry; - rio-prettyprint = upgradeCabal ssuper.rio-prettyprint; - hackage-security = upgradeCabal ssuper.hackage-security; - hpack = upgradeCabal sself.hpack_0_39_1; - stack = upgradeCabal ssuper.stack; - } - ) - ); - # # Version upgrades # From f87fabdc914a67d60f6f2352a9fa6978f1f41078 Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 23 Jun 2026 14:19:14 +0200 Subject: [PATCH 2/3] stack: drop released patch --- .../haskell-modules/configuration-common.nix | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index c24e8c700425..22689c14dda4 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -161,29 +161,6 @@ with haskellLib; hackage-db-unstable ; - # Stack uses pure nix-shells for certain operations including HTTPS requests - # This patch makes stack add pkgs.cacert, so the certificate DB is available. - # https://github.com/commercialhaskell/stack/pull/6854 krank:ignore-line - stack = - appendPatches - [ - (pkgs.fetchpatch { - name = "stack-add-cacert-to-pure-shells.patch"; - url = "https://github.com/commercialhaskell/stack/commit/e869263cbd84a9e59ce1fa467e82993c8e7fb1dd.patch"; - hash = "sha256-O7GaNgcGBY6m6GHqVtejqOu2HCWWKWXARPnr/upT1RQ="; - includes = [ "src/Stack/Nix.hs" ]; - }) - ] - ( - overrideCabal (drv: { - # Stack's source files use CRLF - prePatch = '' - ${drv.prePatch or ""} - sed -i -e 's/\r$//' src/Stack/Nix.hs - ''; - }) super.stack - ); - # Extensions wants a specific version of Cabal for its list of Haskell # language extensions. extensions = doJailbreak ( From f479cbacabc19e9d7e0d7e86cd4cd14315d7dc89 Mon Sep 17 00:00:00 2001 From: sterni Date: Sun, 28 Jun 2026 16:05:49 +0200 Subject: [PATCH 3/3] stack: apply patches for semaphore-compat >= 2.0 Apply patches from https://github.com/commercialhaskell/stack/pull/6935 allowing us to build stack with GHC 9.12.5-rc2 (but no other GHC version). Patch for the change log is not included (due to likely conflict problems), but other documentation included with stack is updated. We also apply an unrelated bug fix, so we don't need to rebase the patches. --- .../haskell-modules/configuration-common.nix | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 22689c14dda4..1cfa5963635d 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -161,6 +161,46 @@ with haskellLib; hackage-db-unstable ; + stack = + appendPatches + [ + # Bug fix that is also necessary for the following patches to apply + (pkgs.fetchpatch { + name = "stack-dep-without-main-library.patch"; + url = "https://github.com/commercialhaskell/stack/commit/591b6eb225b4cd2cfa4d282089fdb33e86bb14ad.patch"; + hash = "sha256-GTUBGZ1KWQii60Yt9JpKcwMkzuIuSTdKLGd3aM0jXWw="; + }) + # FIXME(@sternenseemann): these URLs are not stable (yet) + # Pick patches to support semaphore-compat >= 2.0 + # from https://github.com/commercialhaskell/stack/pull/6935 + # c.f. https://github.com/commercialhaskell/stack/issues/693 + (pkgs.fetchpatch { + name = "stack-semaphore-compat-2.0.patch"; + url = "https://github.com/commercialhaskell/stack/commit/c9e3cbc3f460de65d5abeffb583242255b41be23.patch"; + includes = [ "src/**" ]; + hash = "sha256-flf1f/QoBZAw9VRTzdNJQu+Zt1b+9q/pi7+1ukCad6c="; + }) + (pkgs.fetchpatch { + name = "stack-semaphore-compat-compiler-paths.patch"; + url = "https://github.com/commercialhaskell/stack/commit/02fa193245fc7210c6ce88646b2fa94ab39b9fc4.patch"; + hash = "sha256-oE0GfXADSYlPceurzeZbq1Ix14gOtZEBssA8ZINv2qs="; + }) + (pkgs.fetchpatch { + name = "stack-semaphore-ghc-compat-map.patch"; + url = "https://github.com/commercialhaskell/stack/commit/960e704b9cd61094b75fad4689f0034b4435a268.patch"; + hash = "sha256-zYIsttG3z4gbpfXgQsKz0PlkAEzODlLYiYdPpfBohvM="; + }) + ] + ( + overrideCabal (drv: { + # Stack's source files use CRLF + prePatch = '' + ${drv.prePatch or ""} + find doc src -type f -exec sed -i -e 's/\r$//' '{}' '+' + ''; + }) super.stack + ); + # Extensions wants a specific version of Cabal for its list of Haskell # language extensions. extensions = doJailbreak (