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