1{ pkgs, haskellLib }:
2
3self: super:
4
5with haskellLib;
6
7let
8 inherit (pkgs) lib;
9
10 warnAfterVersion =
11 ver: pkg:
12 lib.warnIf (lib.versionOlder ver
13 super.${pkg.pname}.version
14 ) "override for haskell.packages.ghc96.${pkg.pname} may no longer be needed" pkg;
15
16in
17
18{
19 # Disable GHC core libraries
20 array = null;
21 base = null;
22 binary = null;
23 bytestring = null;
24 Cabal = null;
25 Cabal-syntax = null;
26 containers = null;
27 deepseq = null;
28 directory = null;
29 exceptions = null;
30 filepath = null;
31 ghc-bignum = null;
32 ghc-boot = null;
33 ghc-boot-th = null;
34 ghc-compact = null;
35 ghc-heap = null;
36 ghc-prim = null;
37 ghci = null;
38 haskeline = null;
39 hpc = null;
40 integer-gmp = null;
41 libiserv = null;
42 mtl = null;
43 parsec = null;
44 pretty = null;
45 process = null;
46 rts = null;
47 stm = null;
48 system-cxx-std-lib = null;
49 template-haskell = null;
50 # terminfo is not built if GHC is a cross compiler
51 terminfo =
52 if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then
53 null
54 else
55 doDistribute self.terminfo_0_4_1_7;
56 text = null;
57 time = null;
58 transformers = null;
59 unix = null;
60 xhtml = null;
61
62 # Becomes a core package in GHC >= 9.8
63 semaphore-compat = doDistribute self.semaphore-compat_1_0_0;
64
65 # Needs base-orphans for GHC < 9.8 / base < 4.19
66 some = addBuildDepend self.base-orphans super.some;
67
68 #
69 # Version deviations from Stackage LTS
70 #
71
72 # Too strict upper bound on template-haskell
73 # https://github.com/mokus0/th-extras/pull/21
74 th-extras = doJailbreak super.th-extras;
75
76 # not in Stackage, needs to match ghc-lib
77 # since expression is generated for 9.8, ghc-lib dep needs to be added manually
78 ghc-tags = doDistribute (addBuildDepends [ self.ghc-lib ] self.ghc-tags_1_8);
79
80 #
81 # Too strict bounds without upstream fix
82 #
83
84 # Forbids transformers >= 0.6
85 quickcheck-classes-base = doJailbreak super.quickcheck-classes-base;
86 # https://github.com/Gabriella439/Haskell-Break-Library/pull/3
87 break = doJailbreak super.break;
88 # Forbids mtl >= 2.3
89 ChasingBottoms = doJailbreak super.ChasingBottoms;
90 # Forbids base >= 4.18
91 cabal-install-solver = doJailbreak super.cabal-install-solver;
92 cabal-install = doJailbreak super.cabal-install;
93
94 # Forbids base >= 4.18, fix proposed: https://github.com/sjakobi/newtype-generics/pull/25
95 newtype-generics = warnAfterVersion "0.6.2" (doJailbreak super.newtype-generics);
96
97 # Jailbreaks for servant <0.20
98 servant-lucid = doJailbreak super.servant-lucid;
99
100 stm-containers = dontCheck super.stm-containers;
101 regex-tdfa = dontCheck super.regex-tdfa;
102 hiedb = dontCheck super.hiedb;
103 retrie = dontCheck super.retrie;
104 # https://github.com/kowainik/relude/issues/436
105 relude = dontCheck (doJailbreak super.relude);
106
107 inherit (pkgs.lib.mapAttrs (_: doJailbreak) super)
108 ghc-trace-events
109 gi-cairo-connector # mtl <2.3
110 ghc-prof # base <4.18
111 env-guard # doctest <0.21
112 package-version # doctest <0.21, tasty-hedgehog <1.4
113 ;
114
115 # Pending text-2.0 support https://github.com/gtk2hs/gtk2hs/issues/327
116 gtk = doJailbreak super.gtk;
117
118 # 2023-12-23: It needs this to build under ghc-9.6.3.
119 # A factor of 100 is insufficient, 200 seems seems to work.
120 hip = appendConfigureFlag "--ghc-options=-fsimpl-tick-factor=200" super.hip;
121
122 # This can be removed once https://github.com/typeclasses/ascii-predicates/pull/1
123 # is merged and in a release that's being tracked.
124 ascii-predicates = appendPatch (pkgs.fetchpatch {
125 url = "https://github.com/typeclasses/ascii-predicates/commit/2e6d9ed45987a8566f3a77eedf7836055c076d1a.patch";
126 name = "ascii-predicates-pull-1.patch";
127 relative = "ascii-predicates";
128 sha256 = "sha256-4JguQFZNRQpjZThLrAo13jNeypvLfqFp6o7c1bnkmZo=";
129 }) super.ascii-predicates;
130
131 # This can be removed once https://github.com/typeclasses/ascii-numbers/pull/1
132 # is merged and in a release that's being tracked.
133 ascii-numbers = appendPatch (pkgs.fetchpatch {
134 url = "https://github.com/typeclasses/ascii-numbers/commit/e9474ad91bc997891f1a46afd5d0bdf9b9f7d768.patch";
135 name = "ascii-numbers-pull-1.patch";
136 relative = "ascii-numbers";
137 sha256 = "sha256-buw1UeW57CFefEfqdDUraSyQ+H/NvCZOv6WF2ORiYQg=";
138 }) super.ascii-numbers;
139
140 # Tests require nothunks < 0.3 (conflicting with Stackage) for GHC < 9.8
141 aeson = dontCheck super.aeson;
142
143 # Apply patch from PR with mtl-2.3 fix.
144 ConfigFile = overrideCabal (drv: {
145 editedCabalFile = null;
146 buildDepends = drv.buildDepends or [ ] ++ [ self.HUnit ];
147 patches = [
148 (pkgs.fetchpatch {
149 # https://github.com/jgoerzen/configfile/pull/12
150 name = "ConfigFile-pr-12.patch";
151 url = "https://github.com/jgoerzen/configfile/compare/d0a2e654be0b73eadbf2a50661d00574ad7b6f87...83ee30b43f74d2b6781269072cf5ed0f0e00012f.patch";
152 sha256 = "sha256-b7u9GiIAd2xpOrM0MfILHNb6Nt7070lNRIadn2l3DfQ=";
153 })
154 ];
155 }) super.ConfigFile;
156
157 # https://github.com/NixOS/nixpkgs/pull/367998#issuecomment-2598941240
158 libtorch-ffi-helper = unmarkBroken (doDistribute super.libtorch-ffi-helper);
159
160 # Compatibility with core libs of GHC 9.6
161 # Jailbreak to lift bound on time
162 kqueue = doJailbreak (
163 appendPatches [
164 (pkgs.fetchpatch {
165 name = "kqueue-ghc-9.6.patch";
166 url = "https://github.com/hesselink/kqueue/pull/10/commits/a2735e807d761410e776482ec04515d9cf76a7f5.patch";
167 sha256 = "18rilz4nrwcmlvll3acjx2lp7s129pviggb8fy3hdb0z34ls5j84";
168 excludes = [ ".gitignore" ];
169 })
170 ] super.kqueue
171 );
172
173 # This runs into the following GHC bug currently affecting 9.6.* and 9.8.* as
174 # well as 9.10.1: https://gitlab.haskell.org/ghc/ghc/-/issues/24432
175 inherit
176 (lib.mapAttrs (
177 _:
178 overrideCabal (drv: {
179 badPlatforms = drv.badPlatforms or [ ] ++ [ "aarch64-linux" ];
180 })
181 ) super)
182 mueval
183 lambdabot
184 lambdabot-haskell-plugins
185 ;
186
187 singletons-base = dontCheck super.singletons-base;
188
189 # A given major version of ghc-exactprint only supports one version of GHC.
190 ghc-exactprint = addBuildDepend self.extra super.ghc-exactprint_1_7_1_0;
191}
192# super.ghc is required to break infinite recursion as Nix is strict in the attrNames
193//
194 lib.optionalAttrs (pkgs.stdenv.hostPlatform.isAarch64 && lib.versionOlder super.ghc.version "9.6.4")
195 {
196 # The NCG backend for aarch64 generates invalid jumps in some situations,
197 # the workaround on 9.6 is to revert to the LLVM backend (which is used
198 # for these sorts of situations even on 9.2 and 9.4).
199 # https://gitlab.haskell.org/ghc/ghc/-/issues/23746#note_525318
200 inherit (lib.mapAttrs (_: self.forceLlvmCodegenBackend) super)
201 tls
202 mmark
203 ;
204 }