3 installDeps = targetPrefix: ''
4 for P in $($out/bin/${targetPrefix}ghc-pkg list --simple-output | sed 's/-[0-9][0-9.]*//g'); do
5 mkdir -p $out/exactDeps/$P
6 touch $out/exactDeps/$P/configure-flags
7 touch $out/exactDeps/$P/cabal.config
9 if id=$($out/bin/${targetPrefix}ghc-pkg field $P id --simple-output); then
10 echo "--dependency=$P=$id" >> $out/exactDeps/$P/configure-flags
11 elif id=$($out/bin/${targetPrefix}ghc-pkg field "z-$P-z-*" id --simple-output); then
12 name=$($out/bin/${targetPrefix}ghc-pkg field "z-$P-z-*" name --simple-output)
13 # so we are dealing with a sublib. As we build sublibs separately, the above
14 # query should be safe.
15 echo "--dependency=''${name#z-$P-z-}=$id" >> $out/exactDeps/$P/configure-flags
17 if ver=$($out/bin/${targetPrefix}ghc-pkg field $P version --simple-output); then
18 echo "constraint: $P == $ver" >> $out/exactDeps/$P/cabal.config
19 echo "constraint: $P installed" >> $out/exactDeps/$P/cabal.config
23 mkdir -p $out/evalDeps
24 for P in $($out/bin/${targetPrefix}ghc-pkg list --simple-output | sed 's/-[0-9][0-9.]*//g'); do
25 touch $out/evalDeps/$P
26 if id=$($out/bin/${targetPrefix}ghc-pkg field $P id --simple-output); then
27 echo "package-id $id" >> $out/evalDeps/$P
31 # For each architecture, what GHC version we should use for bootstrapping.
33 if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
35 compilerNixName = "ghc882";
38 compilerNixName = "ghc844";
41 haskell-nix = prev.haskell-nix // {
42 # Use this to disable the existing haskell infra structure for testing purposes
44 let bootPkgs = with final.buildPackages; {
45 ghc = final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
46 alex = final.haskell-nix.bootstrap.packages.alex-unchecked;
47 happy = final.haskell-nix.bootstrap.packages.happy-unchecked;
48 hscolour = final.haskell-nix.bootstrap.packages.hscolour-unchecked;
50 sphinx = with final.buildPackages; (python3Packages.sphinx_1_7_9 or python3Packages.sphinx);
51 hsc2hs-align-conditionals-patch = final.fetchpatch {
52 url = "https://git.haskell.org/hsc2hs.git/patch/738f3666c878ee9e79c3d5e819ef8b3460288edf";
53 sha256 = "0plzsbfaq6vb1023lsarrjglwgr9chld4q3m99rcfzx0yx5mibp3";
54 extraPrefix = "utils/hsc2hs/";
57 D5123-patch = final.fetchpatch rec { # https://phabricator.haskell.org/D5123
58 url = "http://tarballs.nixos.org/sha256/${sha256}";
60 sha256 = "0nhqwdamf2y4gbwqxcgjxs0kqx23w9gv5kj0zv6450dq19rji82n";
62 haddock-900-patch = final.fetchpatch rec { # https://github.com/haskell/haddock/issues/900
63 url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/983.diff";
64 name = "loadpluginsinmodules.diff";
65 sha256 = "0bvvv0zsfq2581zsir97zfkggc1kkircbbajc2fz3b169ycpbha1";
66 extraPrefix = "utils/haddock/";
69 ghc-patches = version: let
70 # Returns true iff this derivation's version is strictly older than ver.
71 versionLessThan = ver: builtins.compareVersions ver version == 1;
72 # Returns true iff this derivation's version is greater than or equal to ver.
73 versionAtLeast = ver: !versionLessThan ver;
74 from = start: final.lib.optional (versionAtLeast start);
75 fromUntil = start: end: final.lib.optional (versionAtLeast start && versionLessThan end);
76 until = end: final.lib.optional (versionLessThan end);
77 always = final.lib.optional true;
78 # Try to avoid reordering the patches unless a patch is added or changed that
79 # will be applied to most versions of the GHC anyway (reordering the patches
80 # results in rebuilds of GHC and reduces sharing in /nix/store).
81 in fromUntil "8.4.4" "8.6" ./patches/ghc/ghc-8.4.4-reinstallable-lib-ghc.patch
82 ++ until "8.6" ./patches/ghc/iserv-move-8.4.1.patch # 6fbe5f274ba84181f5db50901639ae382ef68c4b -- merged; ghc-8.6.1
83 ++ until "8.6" ./patches/ghc/hsc2hs-8.4.2.patch
84 ++ until "8.6" ./patches/ghc/various-8.4.2.patch
85 ++ until "8.6" ./patches/ghc/lowercase-8.4.2.patch
86 ++ until "8.6" ./patches/ghc/cabal-exe-ext-8.4.2.patch
87 ++ until "8.6" ./patches/ghc/ghc-8.4.3-Cabal2201-SMP-test-fix.patch
88 ++ until "8.6" ./patches/ghc/outputtable-assert-8.4.patch
89 ++ fromUntil "8.6" "8.6.4" ./patches/ghc/MR148--T16104-GhcPlugins.patch
90 ++ until "8.6.4" ./patches/ghc/MR95--ghc-pkg-deadlock-fix.patch
91 ++ fromUntil "8.4" "8.6" ./patches/ghc/iserv-autoconf-8.4.1.patch # (same as below, but based on 8.4)
92 ++ fromUntil "8.6" "8.8" ./patches/ghc/iserv-autoconf-8.6.1.patch # 8f9f52d8e421ce544d5437a93117545d52d0eabd -- merged; ghc-8.8.1
93 ++ fromUntil "8.4" "8.6" ./patches/ghc/iserv-cleanup-8.8.1-prepare-8.4.1.patch # (prepare for below; see patch for details)
94 ++ until "8.10" ./patches/ghc/iserv-cleanup-8.8.1.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/250 -- merged; ghc-8.10.1
95 ++ fromUntil "8.4" "8.6" ./patches/ghc/iserv-cleanup-8.8.1-revert-8.4.1.patch # (revert prepare)
96 ++ fromUntil "8.2" "8.8" ./patches/ghc/MR545--ghc-pkg-databases.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/545 -- merged; ghc-8.8.1
97 ++ fromUntil "8.6" "8.8" ./patches/ghc/outputtable-assert-8.6.patch
98 ++ fromUntil "8.6.4" "8.8" ./patches/ghc/ghc-8.6.4-reenable-th-qq-in-stage1.patch
99 ++ until "8.8" ./patches/ghc/0001-Stop-the-linker-panic.patch # https://phabricator.haskell.org/D5012 -- merged; ghc-8.8.1
100 ++ until "8.8" ./patches/ghc/ghc-8.4.3-Cabal2201-allow-test-wrapper.patch # https://github.com/haskell/cabal/pulls/5995 -- merged; cabal-3.0.0 (ghc-8.8.1)
101 ++ until "8.8" ./patches/ghc/ghc-8.4.3-Cabal2201-response-file-support.patch # https://github.com/haskell/cabal/pulls/5996 -- merged; cabal-3.0.0 (ghc-8.8.1)
102 ++ until "8.8" ./patches/ghc/ghc-8.6-Cabal-fix-datadir.patch # https://github.com/haskell/cabal/issues/5862
103 ++ until "8.8" ./patches/ghc/MR196--ghc-pkg-shut-up.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/196 -- merged; ghc-8.8.1
104 ++ fromUntil "8.6" "8.10" ./patches/ghc/mistuke-ghc-err_clean_up_error_handler-8ab1a89af89848f1713e6849f189de66c0ed7898.diff # this is part of Phyx- revamped io-manager.
105 ++ until "8.10" ./patches/ghc/ghc-add-keepCAFs-to-rts.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/950 -- open
106 ++ until "8.10" ./patches/ghc/lowercase-8.6.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- merged; ghc-8.8.1
107 ++ always ./patches/ghc/dll-loader-8.4.2.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- open
108 ++ always ./patches/ghc/ghc-8.4.3-Cabal2201-no-hackage-tests.patch # ?
109 ++ until "8.10" ./patches/ghc/MR948--32bit-cross-th.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/948 -- open
110 ++ from "8.8" ./patches/ghc/cabal-host.patch # https://github.com/haskell/cabal/issues/5887
111 ++ fromUntil "8.6.4" "8.8" ./patches/ghc/ghc-8.6.4-prim-no-arm-atomics.patch
112 ++ fromUntil "8.6.4" "8.8" ./patches/ghc/global-offset-table.patch
113 ++ fromUntil "8.6.4" "8.8" ./patches/ghc/global-offset-table-2.patch
114 ++ always ./patches/ghc/respect-ar-path.patch
115 ++ until "8.10" ./patches/ghc/MR2537-use-one-shot-kqueue-on-macos.patch
116 ++ final.lib.optional (version == "8.6.3") ./patches/ghc/T16057--ghci-doa-on-windows.patch
117 ++ final.lib.optional (version == "8.6.3") ./patches/ghc/ghc-8.6.3-reinstallable-lib-ghc.patch
118 ++ final.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-reinstallable-lib-ghc.patch
119 ++ final.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-reinstallable-lib-ghc.patch
120 ++ fromUntil "8.6.5" "8.9" ./patches/ghc/ghc-8.6.5-atomic-arm-arch.patch
121 ++ final.lib.optional (version == "8.6.5") ./patches/ghc/MR3214-writable-rel-ro-data.patch
122 ++ final.lib.optional (version == "8.8.1") ./patches/ghc/ghc-8.8.1-reinstallable-lib-ghc.patch
123 ++ fromUntil "8.8.2" "8.9" ./patches/ghc/ghc-8.8.2-reinstallable-lib-ghc.patch
124 ++ final.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-better-plusSimplCountErrors.patch
125 ++ final.lib.optional (versionAtLeast "8.6.4" && final.stdenv.isDarwin) ./patches/ghc/ghc-macOS-loadArchive-fix.patch
126 ++ final.lib.optional (versionAtLeast "8.4.4" && versionLessThan "8.10" && final.stdenv.isDarwin) ./patches/ghc/ghc-darwin-gcc-version-fix.patch
127 ++ final.lib.optional (versionAtLeast "8.10.1" && final.stdenv.isDarwin) ./patches/ghc/ghc-8.10-darwin-gcc-version-fix.patch
128 # backport of https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3227
129 # the first one is a prerequisite.
130 # both are trimmed to only include the make build system part and not the
132 ++ fromUntil "8.8" "8.10.2" ./patches/ghc/bec76733b818b0489ffea0834ab6b1560207577c.patch
133 ++ fromUntil "8.8" "8.8.4" ./patches/ghc/67738db10010fd28a8e997b5c8f83ea591b88a0e.patch
134 ++ fromUntil "8.10" "8.10.2" ./patches/ghc/67738db10010fd28a8e997b5c8f83ea591b88a0e.patch
135 ++ final.lib.optional (versionAtLeast "8.6.4" && versionLessThan "8.8") ./patches/ghc/ghc-no-system-linker.patch
137 ++ fromUntil "8.10.2" "8.12" ./patches/ghc/MR3714-backported-to-8.10.2.patch
139 ++ from "8.10.1" ./patches/ghc/ghc-acrt-iob-func.patch
141 ++ fromUntil "8.10.1" "8.11" ./patches/ghc/ghc-8.10-ubxt.patch
142 ++ final.lib.optional (versionAtLeast "8.6.4") ./patches/ghc/Cabal-3886.patch
145 ghc844 = final.callPackage ../compiler/ghc {
146 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc844; };
148 inherit sphinx installDeps;
149 bootPkgs = bootPkgs // {
150 # GHC 8.6.5 and earlier need happy 1.19.11
151 happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked;
154 buildLlvmPackages = final.buildPackages.llvmPackages_5;
155 llvmPackages = final.llvmPackages_5;
159 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
160 sha256 = "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i";
163 ghc-patches = ghc-patches "8.4.4"
164 ++ [ hsc2hs-align-conditionals-patch D5123-patch ]
165 ++ final.lib.optional final.stdenv.isDarwin ./patches/ghc/ghc-8.4.4-backport-dylib-command-size-limit.patch;
167 ghc861 = final.callPackage ../compiler/ghc {
168 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc861; };
170 inherit sphinx installDeps;
171 bootPkgs = bootPkgs // {
172 # GHC 8.6.5 and earlier need happy 1.19.11
173 happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked;
176 buildLlvmPackages = final.buildPackages.llvmPackages_6;
177 llvmPackages = final.llvmPackages_6;
181 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
182 sha256 = "0dkh7idgrqr567fq94a0f5x3w0r4cm2ydn51nb5wfisw3rnw499c";
185 ghc-patches = [ D5123-patch ];
187 ghc862 = final.callPackage ../compiler/ghc {
188 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc862; };
190 inherit sphinx installDeps;
191 bootPkgs = bootPkgs // {
192 # GHC 8.6.5 and earlier need happy 1.19.11
193 happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked;
196 buildLlvmPackages = final.buildPackages.llvmPackages_6;
197 llvmPackages = final.llvmPackages_6;
201 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
202 sha256 = "1mbn3n2ynmpfpb7jfnhpzzli31qqxqyi8ws71blws3i846fq3ana";
205 ghc-patches = ghc-patches "8.6.2"
208 ghc863 = final.callPackage ../compiler/ghc {
209 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc863; };
211 inherit sphinx installDeps;
212 bootPkgs = bootPkgs // {
213 # GHC 8.6.5 and earlier need happy 1.19.11
214 happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked;
217 buildLlvmPackages = final.buildPackages.llvmPackages_6;
218 llvmPackages = final.llvmPackages_6;
222 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
223 sha256 = "08vzq0dpg4a39bs61j6rq4z0n7jby5mc69h4m25xhd8rjyvkg7lz";
226 ghc-patches = ghc-patches "8.6.3"
229 ghc864 = final.callPackage ../compiler/ghc {
230 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc864; };
232 inherit sphinx installDeps;
233 bootPkgs = bootPkgs // {
234 # GHC 8.6.5 and earlier need happy 1.19.11
235 happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked;
238 buildLlvmPackages = final.buildPackages.llvmPackages_6;
239 llvmPackages = final.llvmPackages_6;
243 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
244 sha256 = "0fihs1sr0hpk67dn9cmrsav13kkcp9hz8ggdqcrs80rj8vj0fpav";
247 ghc-patches = ghc-patches "8.6.4"
250 ghc865 = final.callPackage ../compiler/ghc {
251 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc865; };
253 inherit sphinx installDeps;
254 bootPkgs = bootPkgs // {
255 # GHC 8.6.5 and earlier need happy 1.19.11
256 happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked;
259 buildLlvmPackages = final.buildPackages.llvmPackages_6;
260 llvmPackages = final.llvmPackages_6;
264 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
265 sha256 = "0qg3zsmbk4rkwkc3jpas3zs74qaxmw4sp4v1mhsbj0a0dzls2jjd";
268 ghc-patches = ghc-patches "8.6.5"
269 ++ [ D5123-patch haddock-900-patch ];
271 ghc881 = final.callPackage ../compiler/ghc {
272 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc881; };
274 inherit bootPkgs sphinx installDeps;
276 buildLlvmPackages = final.buildPackages.llvmPackages_7;
277 llvmPackages = final.llvmPackages_7;
281 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
282 sha256 = "06kj4fhvijinjafiy4s873n60qly323rdlz9bmc79nhlp3cq72lh";
285 ghc-patches = ghc-patches "8.8.1";
287 ghc882 = final.callPackage ../compiler/ghc {
288 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc882; };
290 inherit bootPkgs sphinx installDeps;
292 buildLlvmPackages = final.buildPackages.llvmPackages_7;
293 llvmPackages = final.llvmPackages_7;
297 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
298 sha256 = "02qa6wgjpxgakg7hv4zfdlrx9k7zxa5i02wnr6y9fsv8j16sbkh1";
301 ghc-patches = ghc-patches "8.8.2";
303 ghc883 = final.callPackage ../compiler/ghc {
304 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc883; };
306 inherit bootPkgs sphinx installDeps;
308 buildLlvmPackages = final.buildPackages.llvmPackages_7;
309 llvmPackages = final.llvmPackages_7;
313 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
314 sha256 = "128g932i3wix6ic03v04nh5755vyjiidzri9iybwad72yfmc1p70";
317 ghc-patches = ghc-patches "8.8.3";
319 ghc884 = final.callPackage ../compiler/ghc {
320 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc884; };
322 inherit bootPkgs sphinx installDeps;
324 buildLlvmPackages = final.buildPackages.llvmPackages_7;
325 llvmPackages = final.llvmPackages_7;
329 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
330 sha256 = "0bgwbxxvdn56l91bp9p5d083gzcfdi6z8l8b17qzjpr3n8w5wl7h";
333 ghc-patches = ghc-patches "8.8.4";
335 ghc8101 = final.callPackage ../compiler/ghc {
336 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8101; };
338 bootPkgs = bootPkgs // {
339 # Not using 8.8 due to https://gitlab.haskell.org/ghc/ghc/-/issues/18143
340 ghc = final.buildPackages.buildPackages.haskell-nix.compiler.ghc865;
342 inherit sphinx installDeps;
344 buildLlvmPackages = final.buildPackages.llvmPackages_9;
345 llvmPackages = final.llvmPackages_9;
349 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
350 sha256 = "1xgdl6ig5jzli3bg054vfryfkg0y6wggf68g66c32sr67bw0ffsf";
353 ghc-patches = ghc-patches "8.10.1";
355 ghc8102 = final.callPackage ../compiler/ghc {
356 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8102; };
358 bootPkgs = bootPkgs // {
359 # Not using 8.8 due to https://gitlab.haskell.org/ghc/ghc/-/issues/18143
360 ghc = final.buildPackages.buildPackages.haskell-nix.compiler.ghc865;
362 inherit sphinx installDeps;
364 buildLlvmPackages = final.buildPackages.llvmPackages_9;
365 llvmPackages = final.llvmPackages_9;
369 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
370 sha256 = "02w8n085bw38vyp694j0lfk5wcnwkdaj7hhp0saj71x74533lmww";
373 ghc-patches = ghc-patches "8.10.2";
375 # ghc 8.10.2 with patches needed by plutus
376 ghc8102-experimental = final.callPackage ../compiler/ghc {
377 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8102-experimental; };
379 bootPkgs = bootPkgs // {
380 # Not using 8.8 due to https://gitlab.haskell.org/ghc/ghc/-/issues/18143
381 ghc = final.buildPackages.buildPackages.haskell-nix.compiler.ghc865;
383 inherit sphinx installDeps;
385 buildLlvmPackages = final.buildPackages.llvmPackages_9;
386 llvmPackages = final.llvmPackages_9;
390 url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
391 sha256 = "02w8n085bw38vyp694j0lfk5wcnwkdaj7hhp0saj71x74533lmww";
394 ghc-patches = ghc-patches "8.10.2"
395 ++ [ ./patches/ghc/core-field.patch ];
397 } // final.lib.optionalAttrs (final.targetPlatform.isGhcjs or false)
398 # This will inject `exactDeps` and `envDeps` into the ghcjs
399 # compiler defined below. This is crucial to build packages
400 # with the current use of env and exact Deps.
404 isHaskellNixBootCompiler = true;
407 ghc865 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc865;
408 in let ghcjs865 = final.callPackage ../compiler/ghcjs/ghcjs.nix {
409 ghcjsSrcJson = ../compiler/ghcjs/ghcjs-src.json;
410 ghcjsVersion = "8.6.0.1";
412 cabal-install = final.buildPackages.haskell-nix.cabal-install;
413 # The alex from the bootstrap packages is apparently broken, and will fail with something like:
414 # > alex: /nix/store/f7b78rg9pmqgvxvsqfzh1przp7pxii5a-alex-3.2.4-exe-alex/share/x86_64-osx-ghc-8.4.4/alex-3.2.4-1pf5faR9dBuJ8mryql0DoA-alex/AlexTemplate-ghc-nopred: openFile: does not exist (No such file or directory)
415 # inherit (final.buildPackages.haskell-nix.bootstrap.packages) alex happy;
416 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.6.5" {
418 inherit targetPrefix;
420 isHaskellNixCompiler = true;
421 inherit (ghcjs865) configured-src;
423 extraConfigureFlags = [
425 "--with-ghcjs=${targetPrefix}ghc" "--with-ghcjs-pkg=${targetPrefix}ghc-pkg"
426 # setting gcc is stupid. non-emscripten ghcjs has no cc.
427 # however cabal insists on compiling the c sources. m(
428 "--with-gcc=${final.buildPackages.stdenv.cc}/bin/cc"
431 # note: we'll use the buildGHCs `hsc2hs`, ghcjss wrapper just horribly breaks in this nix setup.
435 ln -s ${ghcjs865}/bin/ghcjs ${targetPrefix}ghc
436 ln -s ${ghcjs865}/bin/ghcjs-pkg ${targetPrefix}ghc-pkg
437 ln -s ${buildGHC}/bin/hsc2hs ${targetPrefix}hsc2hs
441 cp -R ${ghcjs865}/lib/ghcjs-8.6.5 ${targetPrefix}ghc-8.6.5
442 '' + installDeps targetPrefix);
445 # Both `cabal-install` and `nix-tools` are needed for `cabalProject`
446 # to check materialized results. We need to take care that when
447 # it is doing this we do not check the materialization of the
448 # tools used or there will be infinite recursion.
449 # always has `checkMaterialization = false` to avoid infinite
451 cabal-install-tool = {compiler-nix-name, ...}@args:
452 (final.haskell-nix.hackage-package ({
453 name = "cabal-install";
455 index-state = final.haskell-nix.internalHackageIndexState;
456 # When building cabal-install (only happens when checking materialization)
457 # disable checking of the tools used to avoid infinite recursion.
458 cabal-install = final.evalPackages.haskell-nix.cabal-install-unchecked.${compiler-nix-name};
459 nix-tools = final.evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name};
460 materialized = ../materialized + "/${compiler-nix-name}/cabal-install";
461 } // args)).components.exes.cabal;
462 nix-tools-set = { compiler-nix-name, ... }@args:
465 final.haskell-nix.cabalProject ({
467 src = final.haskell-nix.sources.nix-tools;
468 index-state = final.haskell-nix.internalHackageIndexState;
469 cabalProjectLocal = ''
470 allow-newer: Cabal:base, cryptohash-sha512:base, haskeline:base
471 index-state: ${final.haskell-nix.internalHackageIndexState}
473 # When building cabal-install (only happens when checking materialization)
474 # disable checking of the tools used to avoid infinite recursion.
475 cabal-install = final.evalPackages.haskell-nix.cabal-install-unchecked.${compiler-nix-name};
476 nix-tools = final.evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name};
477 materialized = ../materialized + "/${compiler-nix-name}/nix-tools";
479 packages.transformers-compat.components.library.doExactConfig = true;
480 packages.time-compat.components.library.doExactConfig = true;
481 packages.time-locale-compat.components.library.doExactConfig = true;
482 # Make Cabal reinstallable
483 nonReinstallablePkgs =
484 [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
485 "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
487 "ghc" "Win32" "array" "binary" "bytestring" "containers"
488 "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
490 "mtl" "parsec" "process" "text" "time" "transformers"
495 exes = project.nix-tools.components.exes // project.hpack.components.exes;
497 final.buildPackages.nix
498 # Double buildPackages is intentional, see comment in lib/default.nix for details.
499 final.buildPackages.buildPackages.gitMinimal
500 final.buildPackages.buildPackages.nix-prefetch-git ];
504 paths = builtins.attrValues exes;
505 buildInputs = [ final.makeWrapper ];
506 meta.platforms = final.lib.platforms.all;
507 # We wrap the -to-nix executables with the executables from `tools` (e.g. nix-prefetch-git)
508 # so that consumers of `nix-tools` won't have to provide those tools.
510 for prog in stack-to-nix cabal-to-nix plan-to-nix; do
511 wrapProgram "$out/bin/$prog" --prefix PATH : "${final.lib.makeBinPath tools}"
516 # Memoize the cabal-install and nix-tools derivations by adding:
517 # haskell-nix.cabal-install.ghcXXX
518 # haskell-nix.cabal-install-unchecked.ghcXXX
519 # haskell-nix.nix-tools.ghcXXX
520 # haskell-nix.nix-tools-unchecked.ghcXXX
521 # Using these avoids unnecessary calls to mkDerivation.
522 # For cabal projects we match the versions used to the compiler
523 # selected for the project to avoid the chance of a dependency
524 # another GHC version (particularly useful on macOS where
525 # executables are dynamically linked to GHC itself, which means
526 # that if you use a tool built with a different GHC you will get
527 # that GHC itself in your closure).
528 cabal-install = final.lib.mapAttrs (compiler-nix-name: _:
529 final.haskell-nix.cabal-install-tool { inherit compiler-nix-name; }) final.haskell-nix.compiler;
530 cabal-install-unchecked = final.lib.mapAttrs (compiler-nix-name: _:
531 final.haskell-nix.cabal-install-tool {
533 # If there is no materialized version for this GHC version fall back on
534 # a version of GHC for which there will be.
535 if __pathExists (../materialized + "/${compiler-nix-name}/cabal-install/default.nix")
536 then compiler-nix-name
538 checkMaterialization = false;
539 }) final.haskell-nix.compiler;
540 nix-tools = final.lib.mapAttrs (compiler-nix-name: _:
541 final.haskell-nix.nix-tools-set { inherit compiler-nix-name; }) final.haskell-nix.compiler;
542 nix-tools-unchecked = final.lib.mapAttrs (compiler-nix-name: _:
543 final.haskell-nix.nix-tools-set {
545 # If there is no materialized version for this GHC version fall back on
546 # a version of GHC for which there will be.
547 if __pathExists (../materialized + "/${compiler-nix-name}/nix-tools/default.nix")
548 then compiler-nix-name
550 checkMaterialization = false;
551 }) final.haskell-nix.compiler;
553 # These `internal` versions are used for:
554 # * `nix-tools` for stack projects (since we use `nix-tools` to process
555 # the `stack.yaml` file we cannot match the ghc of the project the
556 # way we do for cabal projects).
557 # * Scripts are used to update stackage and hackage
558 # Updating the version of GHC selected here should be fairly safe as
559 # there should be no difference in the behaviour of these tools.
560 # (stack projects on macOS may see a significant change in the
561 # closure size of their build dependencies due to dynamic linking).
562 internal-cabal-install = final.haskell-nix.cabal-install.ghc884;
563 internal-nix-tools = final.haskell-nix.nix-tools.ghc884;
565 # WARN: The `import ../. {}` will prevent
566 # any cross to work, as we will loose
567 # the `config` value.
568 # As such the following sadly won't work :(
569 # haskellPackages = with import ../. {}; {
571 # hello = (hackage-package {
572 # inherit (final) cabal-install;
573 # name = "hello"; version = "1.0.0.2";
574 # }).components.exes.hello;
577 # NOTE: 8.6.5 prebuilt binaries on macOS, will yield:
579 # > Linking dist/build/cabal/cabal ...
580 # > Undefined symbols for architecture x86_64:
581 # > "_utimensat", referenced from:
582 # > _cazW_info in libHSdirectory-1.3.3.0.a(Posix.o)
583 # > ld: symbol(s) not found for architecture x86_64
584 # > clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
585 # > `clang' failed in phase `Linker'. (Exit code: 1)
587 # hence we'll use 844 for bootstrapping for now.
590 # the bootstrap infra structure (pre-compiled ghc; bootstrapped cabal-install, ...)
591 bootstrap = with final.haskell-nix;
593 # This compiler-nix-name will only be used to build nix-tools and cabal-install
594 # when checking materialization of alex, happy and hscolour.
595 compiler-nix-name = "ghc865";
596 nix-tools = final.evalPackages.haskell-nix.nix-tools.${compiler-nix-name};
597 cabal-install = final.evalPackages.haskell-nix.cabal-install.${compiler-nix-name};
598 # The ghc boot compiler to use to compile alex, happy and hscolour
599 ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
600 ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
601 index-state = final.haskell-nix.internalHackageIndexState;
603 # XXX: import ../. will throw away all other overlays, config values, ...
605 # get binary compilers for bootstrapping. We'll put the eventual proper
606 # compilers into the same place where nix expects them.
607 # We mark these compilers as boot compilers to make sure they are only used
608 # where a boot compiler is expected.
609 compiler = builtins.mapAttrs (_: v:
610 v.overrideAttrs (drv: {
611 postInstall = (drv.postInstall or "") + installDeps "";
614 isHaskellNixBootCompiler = true;
617 (import ../compiler/old-ghc-nix { pkgs = final; });
620 # now that we have nix-tools and hpack, we can just
621 # use `hackage-package` to build any package from
622 # hackage with haskell.nix. For alex and happy we
623 # need to use the boot strap compiler as we need them
624 # to build ghcs from source.
625 # guardMaterializationChecks is used here so we
626 # can turn off materialization checks when
627 # building ghc itself (since GHC is a dependency
628 # of the materialization check it would cause
629 # infinite recursion).
630 alex-tool = args: tool buildBootstrapper.compilerNixName "alex" ({
632 inherit ghcOverride nix-tools cabal-install index-state;
633 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
635 alex = bootstrap.packages.alex-tool {};
636 alex-unchecked = bootstrap.packages.alex-tool { checkMaterialization = false; };
637 happy-tool = { version ? "1.19.12", ... }@args: tool buildBootstrapper.compilerNixName "happy" ({
638 inherit version ghcOverride nix-tools cabal-install index-state;
639 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${version}";
641 happy = bootstrap.packages.happy-tool {};
642 happy-unchecked = bootstrap.packages.happy-tool { checkMaterialization = false; };
643 # Older version needed when building ghc 8.6.5
644 happy-old = bootstrap.packages.happy-tool { version = "1.19.11"; };
645 happy-old-unchecked = bootstrap.packages.happy-tool { version = "1.19.11"; checkMaterialization = false; };
646 hscolour-tool = args: (hackage-package ({
647 compiler-nix-name = buildBootstrapper.compilerNixName;
650 inherit ghcOverride nix-tools cabal-install index-state;
651 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
652 } // args)).components.exes.HsColour;
653 hscolour = bootstrap.packages.hscolour-tool {};
654 hscolour-unchecked = bootstrap.packages.hscolour-tool { checkMaterialization = false; };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list