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