|
32 | 32 | # - What GHC version we should use for bootstrapping.
|
33 | 33 | # - What Happy version we should use for bootstrapping.
|
34 | 34 | buildBootstrapper =
|
35 |
| - if final.targetPlatform.isAarch64 |
| 35 | + if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 |
36 | 36 | then {
|
37 |
| - ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc882; |
| 37 | + compilerNixName = "ghc882"; |
38 | 38 | happyVersion = "1.19.12";
|
39 | 39 | }
|
40 | 40 | else {
|
41 |
| - ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc844; |
| 41 | + compilerNixName = "ghc844"; |
42 | 42 | happyVersion = "1.19.11";
|
43 | 43 | };
|
44 |
| - # For buildPackages.buildPackages, we just care about the GHC version: |
45 |
| - buildBuildBootstrapper = |
46 |
| - if final.targetPlatform.isAarch64 |
47 |
| - then final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler.ghc882 |
48 |
| - else final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler.ghc844; |
49 | 44 | in {
|
50 | 45 | haskell-nix = prev.haskell-nix // {
|
51 | 46 | # Use this to disable the existing haskell infra structure for testing purposes
|
52 | 47 | compiler =
|
53 | 48 | let bootPkgs = with final.buildPackages; {
|
54 |
| - ghc = buildBuildBootstrapper; |
| 49 | + ghc = final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; |
55 | 50 | alex = final.haskell-nix.bootstrap.packages.alex-tool {
|
56 | 51 | checkMaterialization = false;
|
57 | 52 | };
|
|
338 | 333 | '' + installDeps targetPrefix);
|
339 | 334 | })));
|
340 | 335 |
|
341 |
| - # Need to use something from 8.8.x as the default on aarch64: |
| 336 | + # Need to use something from 8.8.x as the default to build aarch64 native compiler: |
342 | 337 | defaultCompilerNixName =
|
343 |
| - if final.targetPlatform.isAarch64 |
| 338 | + if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 |
344 | 339 | then "ghc883"
|
345 | 340 | else "ghc865";
|
346 | 341 | ghc = final.haskell-nix.compiler."${final.haskell-nix.defaultCompilerNixName}";
|
|
426 | 421 | } // args);
|
427 | 422 | alex = final.buildPackages.haskell-nix.alex-tool {};
|
428 | 423 | happy-tool = args: final.haskell-nix.tool "happy" ({
|
429 |
| - version = buildBootstrapper.happyVersion; |
| 424 | + version = "1.19.12"; |
430 | 425 | index-state = final.haskell-nix.internalHackageIndexState;
|
431 | 426 | materialized = ../materialized + "/${
|
432 | 427 | args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName
|
|
460 | 455 |
|
461 | 456 |
|
462 | 457 | # the bootstrap infra structure (pre-compiled ghc; bootstrapped cabal-install, ...)
|
463 |
| - bootstrap = with final.haskell-nix; let ghc = buildBootstrapper.ghc; in { |
| 458 | + bootstrap = with final.haskell-nix; |
| 459 | + let ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; |
| 460 | + in { |
464 | 461 | # XXX: import ../. will throw away all other overlays, config values, ...
|
465 | 462 | # this is not ideal!
|
466 | 463 | # get binary compilers for bootstrapping. We'll put the eventual proper
|
|
492 | 489 | # Only a boot compiler is suitable here
|
493 | 490 | ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
|
494 | 491 | index-state = final.haskell-nix.internalHackageIndexState;
|
495 |
| - materialized = ../materialized/bootstrap/alex; |
| 492 | + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex"; |
496 | 493 | } // args);
|
497 | 494 | alex = bootstrap.packages.alex-tool {};
|
498 | 495 | happy-tool = args: tool "happy" ({
|
|
501 | 498 | ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
|
502 | 499 | inherit (bootstrap.packages) cabal-install nix-tools hpack;
|
503 | 500 | index-state = final.haskell-nix.internalHackageIndexState;
|
504 |
| - materialized = ../materialized/bootstrap/happy; |
| 501 | + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${buildBootstrapper.happyVersion}"; |
505 | 502 | } // args);
|
506 | 503 | happy = bootstrap.packages.happy-tool {};
|
507 | 504 | hscolour-tool = args: (hackage-package ({
|
|
510 | 507 | # Only a boot compiler is suitable here
|
511 | 508 | ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
|
512 | 509 | index-state = final.haskell-nix.internalHackageIndexState;
|
513 |
| - materialized = ../materialized/bootstrap/hscolour; |
| 510 | + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour"; |
514 | 511 | } // args)).components.exes.HsColour;
|
515 | 512 | hscolour = bootstrap.packages.hscolour-tool {};
|
516 | 513 | };
|
|
0 commit comments