From 5ad26e362d2e1ccbe7cbc512b422a74e6a325293 Mon Sep 17 00:00:00 2001 From: sterni Date: Sun, 14 Jun 2026 15:17:54 +0200 Subject: [PATCH] haskell.packages.ghc912.glib: patch incompatibility with rts Resolves https://github.com/NixOS/nixpkgs/issues/525467. --- .../haskell-modules/configuration-common.nix | 4 ++++ ...support-rts-at-least-9.12.3-and-9.14.patch | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/haskell-modules/patches/glib-support-rts-at-least-9.12.3-and-9.14.patch diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index a00cc0cdb399..794aebf34ed9 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1547,6 +1547,10 @@ with haskellLib; revision = null; }) super.svgcairo; + # Support GHC >= 9.12.3 || >= 9.14.1 + # Patch from https://github.com/gtk2hs/gtk2hs/pull/349 + glib = appendPatches [ ./patches/glib-support-rts-at-least-9.12.3-and-9.14.patch ] super.glib; + # Too strict upper bound on tasty-hedgehog (<1.5) # https://github.com/typeclasses/ascii-predicates/pull/1 ascii-predicates = doJailbreak super.ascii-predicates; diff --git a/pkgs/development/haskell-modules/patches/glib-support-rts-at-least-9.12.3-and-9.14.patch b/pkgs/development/haskell-modules/patches/glib-support-rts-at-least-9.12.3-and-9.14.patch new file mode 100644 index 000000000000..deeacb0404e5 --- /dev/null +++ b/pkgs/development/haskell-modules/patches/glib-support-rts-at-least-9.12.3-and-9.14.patch @@ -0,0 +1,24 @@ +From 2e1ddf6f4a28819f42db45859a83f3dd7ed14c0e Mon Sep 17 00:00:00 2001 +From: Tuong Nguyen Manh +Date: Sat, 14 Feb 2026 11:58:29 +0100 +Subject: [PATCH] Fix glib for RTS API change in GHC 9.12.3/9.14.1 + +--- + glib/System/Glib/hsgclosure.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/glib/System/Glib/hsgclosure.c b/glib/System/Glib/hsgclosure.c +index 1610702b..6049827f 100644 +--- a/System/Glib/hsgclosure.c ++++ b/System/Glib/hsgclosure.c +@@ -107,7 +107,9 @@ gtk2hs_closure_marshal(GClosure *closure, + WHEN_DEBUG(g_debug("gtk2hs_closure_marshal(%p): about to rts_evalIO", hc->callback)); + + /* perform the call */ +- #if __GLASGOW_HASKELL__>=704 ++ #if (__GLASGOW_HASKELL__>=912 && __GLASGOW_HASKELL_PATCHLEVEL1__>=3) || __GLASGOW_HASKELL__>=914 ++ rts_evalIO(&cap, rts_apply(CAP (HaskellObj)ghc_hs_iface->runIO_closure, call),&ret); ++ #elif __GLASGOW_HASKELL__>=704 + rts_evalIO(&cap, rts_apply(CAP (HaskellObj)runIO_closure, call),&ret); + #else + cap=rts_evalIO(CAP rts_apply(CAP (HaskellObj)runIO_closure, call),&ret);