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