1{
2 buildPackages,
3 pkgsBuildBuild,
4 pkgsBuildTarget,
5 pkgs,
6 newScope,
7 stdenv,
8 config,
9}:
10
11let
12 nativeBignumExcludes = [
13 # haskell.compiler sub groups
14 "native-bignum"
15 # Binary GHCs
16 "ghc902Binary"
17 "ghc924Binary"
18 "ghc963Binary"
19 "ghc984Binary"
20 ];
21
22 haskellLibUncomposable = import ../development/haskell-modules/lib {
23 inherit (pkgs) lib;
24 inherit pkgs;
25 };
26
27 callPackage = newScope {
28 haskellLib = haskellLibUncomposable.compose;
29 overrides = pkgs.haskell.packageOverrides;
30 };
31
32 bootstrapPackageSet = self: super: {
33 mkDerivation =
34 drv:
35 super.mkDerivation (
36 drv
37 // {
38 doCheck = false;
39 doHaddock = false;
40 enableExecutableProfiling = false;
41 enableLibraryProfiling = false;
42 enableSharedExecutables = false;
43 enableSharedLibraries = false;
44 }
45 );
46 };
47
48 # Use this rather than `rec { ... }` below for sake of overlays.
49 inherit (pkgs.haskell) compiler packages;
50
51 buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_20;
52 llvmPackages = pkgs.llvmPackages_20;
53
54in
55{
56 lib = haskellLibUncomposable;
57
58 package-list = callPackage ../development/haskell-modules/package-list.nix { };
59
60 # Always get boot compilers from `pkgsBuildBuild`. The boot (stage0) compiler
61 # is used to build another compiler (stage1) that'll be used to build the
62 # final compiler (stage2) (except when building a cross-compiler). This means
63 # that stage1's host platform is the same as stage0: build. Consequently,
64 # stage0 needs to be build->build.
65 #
66 # Note that we use bb.haskell.packages.*. haskell.packages.*.ghc is similar to
67 # stdenv: The ghc comes from the previous package set, i.e. this predicate holds:
68 # `name: pkgs: pkgs.haskell.packages.${name}.ghc == pkgs.buildPackages.haskell.compiler.${name}.ghc`.
69 # This isn't problematic since pkgsBuildBuild.buildPackages is also build->build,
70 # just something to keep in mind.
71 compiler = pkgs.lib.recurseIntoAttrs (
72 let
73 bb = pkgsBuildBuild.haskell;
74 in
75 {
76 # Required to bootstrap 9.4.8.
77 ghc902Binary = callPackage ../development/compilers/ghc/9.0.2-binary.nix {
78 inherit llvmPackages;
79 };
80
81 ghc924Binary = callPackage ../development/compilers/ghc/9.2.4-binary.nix { };
82
83 ghc963Binary = callPackage ../development/compilers/ghc/9.6.3-binary.nix { };
84
85 ghc984Binary = callPackage ../development/compilers/ghc/9.8.4-binary.nix { };
86
87 ghc948 = callPackage ../development/compilers/ghc/9.4.8.nix {
88 bootPkgs =
89 # Building with 9.2 is broken due to
90 # https://gitlab.haskell.org/ghc/ghc/-/issues/21914
91 bb.packages.ghc902Binary;
92 inherit (buildPackages.python3Packages) sphinx;
93 # Need to use apple's patched xattr until
94 # https://github.com/xattr/xattr/issues/44 and
95 # https://github.com/xattr/xattr/issues/55 are solved.
96 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
97 inherit buildTargetLlvmPackages llvmPackages;
98 };
99 ghc94 = compiler.ghc948;
100 ghc963 = callPackage ../development/compilers/ghc/9.6.3.nix {
101 bootPkgs = bb.packages.ghc924Binary;
102 inherit (buildPackages.python3Packages) sphinx;
103 # Need to use apple's patched xattr until
104 # https://github.com/xattr/xattr/issues/44 and
105 # https://github.com/xattr/xattr/issues/55 are solved.
106 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
107 inherit buildTargetLlvmPackages llvmPackages;
108 };
109 ghc967 = callPackage ../development/compilers/ghc/9.6.7.nix {
110 bootPkgs = bb.packages.ghc924Binary;
111 inherit (buildPackages.python3Packages) sphinx;
112 # Need to use apple's patched xattr until
113 # https://github.com/xattr/xattr/issues/44 and
114 # https://github.com/xattr/xattr/issues/55 are solved.
115 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
116 inherit buildTargetLlvmPackages llvmPackages;
117 };
118 ghc96 = compiler.ghc967;
119 ghc984 = callPackage ../development/compilers/ghc/9.8.4.nix {
120 bootPkgs =
121 if stdenv.buildPlatform.isAarch64 && stdenv.buildPlatform.isMusl then
122 bb.packages.ghc984Binary
123 else
124 bb.packages.ghc963Binary;
125 inherit (buildPackages.python3Packages) sphinx;
126 # Need to use apple's patched xattr until
127 # https://github.com/xattr/xattr/issues/44 and
128 # https://github.com/xattr/xattr/issues/55 are solved.
129 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
130 inherit buildTargetLlvmPackages llvmPackages;
131 };
132 ghc98 = compiler.ghc984;
133 ghc9101 = callPackage ../development/compilers/ghc/9.10.1.nix {
134 bootPkgs =
135 if stdenv.buildPlatform.isDarwin then
136 # it seems like the GHC 9.6.* bindists are built with a different
137 # toolchain than we are using (which I'm guessing from the fact
138 # that 9.6.4 bindists pass linker flags our ld doesn't support).
139 # With both 9.6.3 and 9.6.4 binary it is impossible to link against
140 # the clock package (probably a hsc2hs problem).
141 bb.packages.ghc963
142 else
143 bb.packages.ghc963Binary;
144 inherit (buildPackages.python3Packages) sphinx;
145 # Need to use apple's patched xattr until
146 # https://github.com/xattr/xattr/issues/44 and
147 # https://github.com/xattr/xattr/issues/55 are solved.
148 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
149 inherit buildTargetLlvmPackages llvmPackages;
150 };
151 ghc9102 = callPackage ../development/compilers/ghc/9.10.2.nix {
152 bootPkgs =
153 if stdenv.buildPlatform.isDarwin then
154 # it seems like the GHC 9.6.* bindists are built with a different
155 # toolchain than we are using (which I'm guessing from the fact
156 # that 9.6.4 bindists pass linker flags our ld doesn't support).
157 # With both 9.6.3 and 9.6.4 binary it is impossible to link against
158 # the clock package (probably a hsc2hs problem).
159 bb.packages.ghc963
160 else
161 bb.packages.ghc963Binary;
162 inherit (buildPackages.python3Packages) sphinx;
163 # Need to use apple's patched xattr until
164 # https://github.com/xattr/xattr/issues/44 and
165 # https://github.com/xattr/xattr/issues/55 are solved.
166 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
167 inherit buildTargetLlvmPackages llvmPackages;
168 };
169 ghc9103 = callPackage ../development/compilers/ghc/9.10.3.nix {
170 bootPkgs =
171 if stdenv.buildPlatform.isDarwin then
172 # it seems like the GHC 9.6.* bindists are built with a different
173 # toolchain than we are using (which I'm guessing from the fact
174 # that 9.6.4 bindists pass linker flags our ld doesn't support).
175 # With both 9.6.3 and 9.6.4 binary it is impossible to link against
176 # the clock package (probably a hsc2hs problem).
177 bb.packages.ghc963
178 else
179 bb.packages.ghc963Binary;
180 inherit (buildPackages.python3Packages) sphinx;
181 # Need to use apple's patched xattr until
182 # https://github.com/xattr/xattr/issues/44 and
183 # https://github.com/xattr/xattr/issues/55 are solved.
184 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
185 # 2023-01-15: Support range >= 11 && < 16
186 buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_15;
187 llvmPackages = pkgs.llvmPackages_15;
188 };
189 ghc910 = compiler.ghc9103;
190 ghc9121 = callPackage ../development/compilers/ghc/9.12.1.nix {
191 bootPkgs =
192 # No suitable bindist packaged yet
193 bb.packages.ghc9103;
194 inherit (buildPackages.python3Packages) sphinx;
195 # Need to use apple's patched xattr until
196 # https://github.com/xattr/xattr/issues/44 and
197 # https://github.com/xattr/xattr/issues/55 are solved.
198 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
199 inherit buildTargetLlvmPackages llvmPackages;
200 };
201 ghc9122 = callPackage ../development/compilers/ghc/9.12.2.nix {
202 bootPkgs =
203 # No suitable bindist packaged yet
204 bb.packages.ghc9103;
205 inherit (buildPackages.python3Packages) sphinx;
206 # Need to use apple's patched xattr until
207 # https://github.com/xattr/xattr/issues/44 and
208 # https://github.com/xattr/xattr/issues/55 are solved.
209 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
210 inherit buildTargetLlvmPackages llvmPackages;
211 };
212 ghc912 = compiler.ghc9122;
213 ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
214 bootPkgs = bb.packages.ghc984Binary;
215 inherit (buildPackages.python3Packages) sphinx;
216 # Need to use apple's patched xattr until
217 # https://github.com/xattr/xattr/issues/44 and
218 # https://github.com/xattr/xattr/issues/55 are solved.
219 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
220 inherit buildTargetLlvmPackages llvmPackages;
221 };
222
223 # Starting from GHC 9, integer-{simple,gmp} is replaced by ghc-bignum
224 # with "native" and "gmp" backends.
225 native-bignum =
226 let
227 nativeBignumGhcNames = pkgs.lib.filter (name: !(builtins.elem name nativeBignumExcludes)) (
228 pkgs.lib.attrNames compiler
229 );
230 in
231 pkgs.recurseIntoAttrs (
232 pkgs.lib.genAttrs nativeBignumGhcNames (
233 name: compiler.${name}.override { enableNativeBignum = true; }
234 )
235 );
236 }
237 // pkgs.lib.optionalAttrs config.allowAliases {
238 ghc810 = throw "'haskell.compiler.ghc810' has been removed."; # Added 2025-09-07
239 ghc90 = throw "'haskell.compiler.ghc90' has been removed."; # Added 2025-09-07
240 ghc92 = throw "'haskell.compiler.ghc92' has been removed."; # Added 2025-09-07
241 ghcjs = throw "'haskell.compiler.ghcjs' has been removed. Please use 'pkgsCross.ghcjs' instead."; # Added 2025-09-06
242 ghcjs810 = throw "'haskell.compiler.ghcjs810' has been removed. Please use 'pkgsCross.ghcjs' instead."; # Added 2025-09-06
243 integer-simple = throw "All GHC versions with integer-simple support have been removed."; # Added 2025-09-07
244 }
245 );
246
247 # Default overrides that are applied to all package sets.
248 packageOverrides = self: super: { };
249
250 # Always get compilers from `buildPackages`
251 packages =
252 let
253 bh = buildPackages.haskell;
254 in
255 {
256 ghc902Binary = callPackage ../development/haskell-modules {
257 buildHaskellPackages = bh.packages.ghc902Binary;
258 ghc = bh.compiler.ghc902Binary;
259 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.0.x.nix { };
260 packageSetConfig = bootstrapPackageSet;
261 };
262 ghc924Binary = callPackage ../development/haskell-modules {
263 buildHaskellPackages = bh.packages.ghc924Binary;
264 ghc = bh.compiler.ghc924Binary;
265 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.2.x.nix { };
266 packageSetConfig = bootstrapPackageSet;
267 };
268 ghc963Binary = callPackage ../development/haskell-modules {
269 buildHaskellPackages = bh.packages.ghc963Binary;
270 ghc = bh.compiler.ghc963Binary;
271 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.6.x.nix { };
272 packageSetConfig = bootstrapPackageSet;
273 };
274 ghc984Binary = callPackage ../development/haskell-modules {
275 buildHaskellPackages = bh.packages.ghc984Binary;
276 ghc = bh.compiler.ghc984Binary;
277 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.8.x.nix { };
278 packageSetConfig = bootstrapPackageSet;
279 };
280 ghc948 = callPackage ../development/haskell-modules {
281 buildHaskellPackages = bh.packages.ghc948;
282 ghc = bh.compiler.ghc948;
283 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.4.x.nix { };
284 };
285 ghc94 = packages.ghc948;
286 ghc963 = callPackage ../development/haskell-modules {
287 buildHaskellPackages = bh.packages.ghc963;
288 ghc = bh.compiler.ghc963;
289 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.6.x.nix { };
290 };
291 ghc967 = callPackage ../development/haskell-modules {
292 buildHaskellPackages = bh.packages.ghc967;
293 ghc = bh.compiler.ghc967;
294 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.6.x.nix { };
295 };
296 ghc96 = packages.ghc967;
297 ghc984 = callPackage ../development/haskell-modules {
298 buildHaskellPackages = bh.packages.ghc984;
299 ghc = bh.compiler.ghc984;
300 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.8.x.nix { };
301 };
302 ghc98 = packages.ghc984;
303 ghc9101 = callPackage ../development/haskell-modules {
304 buildHaskellPackages = bh.packages.ghc9101;
305 ghc = bh.compiler.ghc9101;
306 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.10.x.nix { };
307 };
308 ghc9102 = callPackage ../development/haskell-modules {
309 buildHaskellPackages = bh.packages.ghc9102;
310 ghc = bh.compiler.ghc9102;
311 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.10.x.nix { };
312 };
313 ghc9103 = callPackage ../development/haskell-modules {
314 buildHaskellPackages = bh.packages.ghc9103;
315 ghc = bh.compiler.ghc9103;
316 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.10.x.nix { };
317 };
318 ghc910 = packages.ghc9103;
319 ghc9121 = callPackage ../development/haskell-modules {
320 buildHaskellPackages = bh.packages.ghc9121;
321 ghc = bh.compiler.ghc9121;
322 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.12.x.nix { };
323 };
324 ghc9122 = callPackage ../development/haskell-modules {
325 buildHaskellPackages = bh.packages.ghc9122;
326 ghc = bh.compiler.ghc9122;
327 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.12.x.nix { };
328 };
329 ghc912 = packages.ghc9122;
330 ghcHEAD = callPackage ../development/haskell-modules {
331 buildHaskellPackages = bh.packages.ghcHEAD;
332 ghc = bh.compiler.ghcHEAD;
333 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.14.x.nix { };
334 };
335
336 native-bignum =
337 let
338 nativeBignumGhcNames = pkgs.lib.filter (name: !(builtins.elem name nativeBignumExcludes)) (
339 pkgs.lib.attrNames packages
340 );
341 in
342 pkgs.lib.genAttrs nativeBignumGhcNames (
343 name:
344 packages.${name}.override {
345 ghc = bh.compiler.native-bignum.${name};
346 buildHaskellPackages = bh.packages.native-bignum.${name};
347 }
348 );
349 }
350 // pkgs.lib.optionalAttrs config.allowAliases {
351 ghc810 = throw "'haskell.packages.ghc810' has been removed."; # Added 2025-09-07
352 ghc90 = throw "'haskell.packages.ghc90' has been removed."; # Added 2025-09-07
353 ghc92 = throw "'haskell.packages.ghc92' has been removed."; # Added 2025-09-07
354 ghcjs = throw "'haskell.packages.ghcjs' has been removed. Please use 'pkgsCross.ghcjs' instead."; # Added 2025-09-06
355 ghcjs810 = throw "'haskell.packages.ghcjs810' has been removed. Please use 'pkgsCross.ghcjs' instead."; # Added 2025-09-06
356 integer-simple = throw "All GHC versions with integer-simple support have been removed."; # Added 2025-09-07
357 };
358}