1{
2 config,
3 pkgs,
4 haskellLib,
5}:
6
7with haskellLib;
8
9let
10 inherit (pkgs.stdenv.hostPlatform) isDarwin;
11 inherit (pkgs) lib;
12in
13
14self: super: {
15
16 # Disable GHC 9.0.x core libraries.
17 array = null;
18 base = null;
19 binary = null;
20 bytestring = null;
21 Cabal = null;
22 containers = null;
23 deepseq = null;
24 directory = null;
25 exceptions = null;
26 filepath = null;
27 ghc-bignum = null;
28 ghc-boot = null;
29 ghc-boot-th = null;
30 ghc-compact = null;
31 ghc-heap = null;
32 ghc-prim = null;
33 ghci = null;
34 haskeline = null;
35 hpc = null;
36 integer-gmp = null;
37 libiserv = null;
38 mtl = null;
39 parsec = null;
40 pretty = null;
41 process = null;
42 rts = null;
43 stm = null;
44 template-haskell = null;
45 # GHC only builds terminfo if it is a native compiler
46 terminfo =
47 if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then
48 null
49 else
50 doDistribute self.terminfo_0_4_1_7;
51 text = null;
52 time = null;
53 transformers = null;
54 unix = null;
55 # GHC only bundles the xhtml library if haddock is enabled, check if this is
56 # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
57 xhtml = if self.ghc.hasHaddock or true then null else doDistribute self.xhtml_3000_4_0_0;
58
59 # Need the Cabal-syntax-3.6.0.0 fake package for Cabal < 3.8 to allow callPackage and the constraint solver to work
60 Cabal-syntax = self.Cabal-syntax_3_6_0_0;
61 # These core package only exist for GHC >= 9.4. The best we can do is feign
62 # their existence to callPackages, but their is no shim for lower GHC versions.
63 system-cxx-std-lib = null;
64
65 # Becomes a core package in GHC >= 9.8
66 semaphore-compat = doDistribute self.semaphore-compat_1_0_0;
67
68 # Only required for ghc >= 9.2
69 nothunks = super.nothunks.override {
70 wherefrom-compat = null;
71 };
72
73 # Needs base-orphans for GHC < 9.8 / base < 4.19
74 some = addBuildDepend self.base-orphans super.some;
75
76 # Jailbreaks & Version Updates
77
78 # tar > 0.6 requires os-string which can't be built with bytestring < 0.11
79 tar = doDistribute (doJailbreak self.tar_0_6_0_0);
80 # text-metrics >= 0.3.3 requires GHC2021
81 text-metrics = doDistribute self.text-metrics_0_3_2;
82
83 # For GHC < 9.4, some packages need data-array-byte as an extra dependency
84 primitive = addBuildDepends [ self.data-array-byte ] super.primitive;
85 # For GHC < 9.2, os-string is not required.
86 hashable =
87 addBuildDepends
88 [
89 self.data-array-byte
90 self.base-orphans
91 ]
92 (
93 super.hashable.override {
94 os-string = null;
95 }
96 );
97
98 # Too strict lower bounds on base
99 primitive-addr = doJailbreak super.primitive-addr;
100
101 hashable-time = doJailbreak super.hashable-time;
102 tuple = addBuildDepend self.base-orphans super.tuple;
103 vector-th-unbox = doJailbreak super.vector-th-unbox;
104
105 ormolu = self.ormolu_0_5_2_0.override {
106 Cabal-syntax = self.Cabal-syntax_3_8_1_0;
107 };
108
109 stylish-haskell = doJailbreak super.stylish-haskell_0_14_4_0;
110
111 doctest = dontCheck super.doctest;
112
113 haskell-language-server =
114 lib.throwIf config.allowAliases
115 "haskell-language-server has dropped support for ghc 9.0 in version 2.4.0.0, please use a newer ghc version or an older nixpkgs version"
116 (markBroken super.haskell-language-server);
117
118 # test suite depends on vcr since hpack >= 0.38.1 which requires GHC2021
119 hpack_0_38_1 = dontCheck super.hpack_0_38_1;
120
121 # Needs to use ghc-lib due to incompatible GHC
122 ghc-tags = doDistribute self.ghc-tags_1_5;
123
124 # ghc-lib >= 9.6 and friends no longer build with GHC 9.0
125 ghc-lib-parser = doDistribute self.ghc-lib-parser_9_2_8_20230729;
126 ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_2_1_1;
127 ghc-lib = doDistribute self.ghc-lib_9_2_8_20230729;
128
129 # Test suite sometimes segfaults with GHC 9.0.1 and 9.0.2
130 # https://github.com/ekmett/reflection/issues/51
131 # https://gitlab.haskell.org/ghc/ghc/-/issues/21141
132 reflection = dontCheck super.reflection;
133
134 # Disable tests pending resolution of
135 # https://github.com/Soostone/retry/issues/71
136 retry = dontCheck super.retry;
137
138 ghc-api-compat = unmarkBroken super.ghc-api-compat;
139
140 # 2021-09-18: cabal2nix does not detect the need for ghc-api-compat.
141 hiedb = overrideCabal (old: {
142 libraryHaskellDepends = old.libraryHaskellDepends ++ [ self.ghc-api-compat ];
143 }) super.hiedb;
144
145 # https://github.com/lspitzner/butcher/issues/7
146 butcher = doJailbreak super.butcher;
147
148 # Tests require nothunks < 0.3 (conflicting with Stackage) for GHC < 9.8
149 aeson = dontCheck super.aeson;
150
151 # We use a GHC patch to support the fix for https://github.com/fpco/inline-c/issues/127
152 # which means that the upstream cabal file isn't allowed to add the flag.
153 inline-c-cpp =
154 (if isDarwin then appendConfigureFlags [ "--ghc-option=-fcompact-unwind" ] else x: x)
155 super.inline-c-cpp;
156
157 # 2022-05-31: weeder 2.4.* requires GHC 9.2
158 weeder = doDistribute self.weeder_2_3_1;
159 # Unnecessarily strict upper bound on lens
160 weeder_2_3_1 = doJailbreak (
161 super.weeder_2_3_1.override {
162 # weeder < 2.6 only supports algebraic-graphs < 0.7
163 # We no longer have matching test deps for algebraic-graphs 0.6.1 in the set
164 algebraic-graphs = dontCheck self.algebraic-graphs_0_6_1;
165 }
166 );
167
168 # Later versions only support GHC >= 9.2
169 ghc-exactprint = self.ghc-exactprint_0_6_4;
170
171 retrie = dontCheck self.retrie_1_1_0_0;
172
173 # Needs OneTuple for ghc < 9.2
174 binary-orphans = addBuildDepends [ self.OneTuple ] super.binary-orphans;
175
176 hspec-megaparsec = super.hspec-megaparsec_2_2_0;
177
178 # No instance for (Show B.Builder) arising from a use of ‘print’
179 http-types = dontCheck super.http-types;
180
181 # Packages which need compat library for GHC < 9.6
182 inherit (lib.mapAttrs (_: addBuildDepends [ self.foldable1-classes-compat ]) super)
183 indexed-traversable
184 these
185 ;
186 base-compat-batteries = addBuildDepends [
187 self.foldable1-classes-compat
188 self.OneTuple
189 ] super.base-compat-batteries;
190 OneTuple = addBuildDepends [
191 self.foldable1-classes-compat
192 self.base-orphans
193 ] super.OneTuple;
194}