From f479cbacabc19e9d7e0d7e86cd4cd14315d7dc89 Mon Sep 17 00:00:00 2001 From: sterni Date: Sun, 28 Jun 2026 16:05:49 +0200 Subject: [PATCH] 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 (