1{ pkgs, haskellLib }:
2
3let
4 inherit (pkgs) fetchpatch lib;
5in
6
7with haskellLib;
8self: super: {
9 # Disable GHC core libraries.
10 array = null;
11 base = null;
12 binary = null;
13 bytestring = null;
14 Cabal = null;
15 Cabal-syntax = null;
16 containers = null;
17 deepseq = null;
18 directory = null;
19 exceptions = null;
20 filepath = null;
21 ghc-bignum = null;
22 ghc-boot = null;
23 ghc-boot-th = null;
24 ghc-compact = null;
25 ghc-heap = null;
26 ghc-prim = null;
27 ghci = null;
28 haskeline = null;
29 hpc = null;
30 integer-gmp = null;
31 libiserv = null;
32 mtl = null;
33 parsec = null;
34 pretty = null;
35 process = null;
36 rts = null;
37 stm = null;
38 system-cxx-std-lib = null;
39 template-haskell = null;
40 # GHC only builds terminfo if it is a native compiler
41 terminfo =
42 if pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform then
43 null
44 else
45 doDistribute self.terminfo_0_4_1_7;
46 text = null;
47 time = null;
48 transformers = null;
49 unix = null;
50 # GHC only bundles the xhtml library if haddock is enabled, check if this is
51 # still the case when updating: https://gitlab.haskell.org/ghc/ghc/-/blob/0198841877f6f04269d6050892b98b5c3807ce4c/ghc.mk#L463
52 xhtml = if self.ghc.hasHaddock or true then null else doDistribute self.xhtml_3000_4_0_0;
53
54 # Becomes a core package in GHC >= 9.8
55 semaphore-compat = doDistribute self.semaphore-compat_1_0_0;
56
57 # only broken for >= 9.6
58 calligraphy = doDistribute (unmarkBroken super.calligraphy);
59
60 # Jailbreaks & Version Updates
61
62 hashable-time = doJailbreak super.hashable-time;
63 libmpd = doJailbreak super.libmpd;
64
65 # generically needs base-orphans for 9.4 only
66 base-orphans = dontCheck (doDistribute super.base-orphans);
67 generically = addBuildDepends [
68 self.base-orphans
69 ] super.generically;
70
71 # Needs base-orphans for GHC < 9.8 / base < 4.19
72 some = addBuildDepend self.base-orphans super.some;
73
74 # the dontHaddock is due to a GHC panic. might be this bug, not sure.
75 # https://gitlab.haskell.org/ghc/ghc/-/issues/21619
76 hedgehog = dontHaddock super.hedgehog;
77
78 hpack = overrideCabal (drv: {
79 # Cabal 3.6 seems to preserve comments when reading, which makes this test fail
80 # 2021-10-10: 9.2.1 is not yet supported (also no issue)
81 testFlags = [
82 "--skip=/Hpack/renderCabalFile/is inverse to readCabalFile/"
83 ]
84 ++ drv.testFlags or [ ];
85 }) (doJailbreak super.hpack);
86
87 # 2022-08-01: Tests are broken on ghc 9.2.4: https://github.com/wz1000/HieDb/issues/46
88 hiedb = dontCheck super.hiedb;
89
90 # 2022-10-06: https://gitlab.haskell.org/ghc/ghc/-/issues/22260
91 ghc-check = dontHaddock super.ghc-check;
92
93 ghc-tags = doDistribute (doJailbreak self.ghc-tags_1_7); # aeson < 2.2
94
95 # ghc-lib >= 9.8 and friends no longer build with GHC 9.4 since they require semaphore-compat
96 ghc-lib-parser = doDistribute (
97 self.ghc-lib-parser_9_6_7_20250325.override {
98 happy = self.happy_1_20_1_1; # wants happy < 1.21
99 }
100 );
101 ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_6_0_2;
102 ghc-lib = doDistribute (
103 self.ghc-lib_9_6_7_20250325.override {
104 happy = self.happy_1_20_1_1; # wants happy < 1.21
105 }
106 );
107
108 # A given major version of ghc-exactprint only supports one version of GHC.
109 ghc-exactprint = super.ghc-exactprint_1_6_1_3;
110
111 # Too strict upper bound on template-haskell
112 # https://github.com/mokus0/th-extras/issues/18
113 th-extras = doJailbreak super.th-extras;
114
115 # https://github.com/kowainik/relude/issues/436
116 relude = dontCheck super.relude;
117
118 inherit
119 (
120 let
121 hls_overlay = lself: lsuper: {
122 Cabal-syntax = lself.Cabal-syntax_3_10_3_0;
123 Cabal = lself.Cabal_3_10_3_0;
124 };
125 in
126 lib.mapAttrs (_: pkg: doDistribute (pkg.overrideScope hls_overlay)) {
127 haskell-language-server = allowInconsistentDependencies super.haskell-language-server;
128 fourmolu = doJailbreak self.fourmolu_0_14_0_0; # ansi-terminal, Diff
129 ormolu = doJailbreak self.ormolu_0_7_2_0; # ansi-terminal
130 hlint = self.hlint_3_6_1;
131 stylish-haskell = self.stylish-haskell_0_14_5_0;
132 }
133 )
134 haskell-language-server
135 fourmolu
136 ormolu
137 hlint
138 stylish-haskell
139 ;
140
141 # directory-ospath-streaming requires the ospath API in core packages
142 # filepath, directory and unix.
143 stan = super.stan.override {
144 directory-ospath-streaming = null;
145 };
146
147 # Packages which need compat library for GHC < 9.6
148 inherit (lib.mapAttrs (_: addBuildDepends [ self.foldable1-classes-compat ]) super)
149 indexed-traversable
150 OneTuple
151 these
152 ;
153 base-compat-batteries = addBuildDepends [
154 self.foldable1-classes-compat
155 self.OneTuple
156 ] super.base-compat-batteries;
157
158 # Tests require nothunks < 0.3 (conflicting with Stackage) for GHC < 9.8
159 aeson = dontCheck super.aeson;
160
161 # Too strict lower bound on base
162 primitive-addr = doJailbreak super.primitive-addr;
163}