diff --git a/materialized/bootstrap/alex/.plan.nix/alex.nix b/materialized/bootstrap/ghc844/alex/.plan.nix/alex.nix similarity index 100% rename from materialized/bootstrap/alex/.plan.nix/alex.nix rename to materialized/bootstrap/ghc844/alex/.plan.nix/alex.nix diff --git a/materialized/bootstrap/alex/default.nix b/materialized/bootstrap/ghc844/alex/default.nix similarity index 100% rename from materialized/bootstrap/alex/default.nix rename to materialized/bootstrap/ghc844/alex/default.nix diff --git a/materialized/bootstrap/happy/.plan.nix/happy.nix b/materialized/bootstrap/ghc844/happy-1.19.11/.plan.nix/happy.nix similarity index 100% rename from materialized/bootstrap/happy/.plan.nix/happy.nix rename to materialized/bootstrap/ghc844/happy-1.19.11/.plan.nix/happy.nix diff --git a/materialized/bootstrap/happy/default.nix b/materialized/bootstrap/ghc844/happy-1.19.11/default.nix similarity index 100% rename from materialized/bootstrap/happy/default.nix rename to materialized/bootstrap/ghc844/happy-1.19.11/default.nix diff --git a/materialized/bootstrap/hscolour/.plan.nix/hscolour.nix b/materialized/bootstrap/ghc844/hscolour/.plan.nix/hscolour.nix similarity index 100% rename from materialized/bootstrap/hscolour/.plan.nix/hscolour.nix rename to materialized/bootstrap/ghc844/hscolour/.plan.nix/hscolour.nix diff --git a/materialized/bootstrap/hscolour/default.nix b/materialized/bootstrap/ghc844/hscolour/default.nix similarity index 99% rename from materialized/bootstrap/hscolour/default.nix rename to materialized/bootstrap/ghc844/hscolour/default.nix index e37d34ad04..3add7c294a 100644 --- a/materialized/bootstrap/hscolour/default.nix +++ b/materialized/bootstrap/ghc844/hscolour/default.nix @@ -1,3 +1,4 @@ + { pkgs = hackage: { @@ -30,4 +31,4 @@ ({ lib, ... }: { packages = { "hscolour" = { flags = {}; }; }; }) ]; - } \ No newline at end of file + } diff --git a/nix-tools/regenerate.nix b/nix-tools/regenerate.nix index 58a868ff5c..4d291732fa 100644 --- a/nix-tools/regenerate.nix +++ b/nix-tools/regenerate.nix @@ -55,7 +55,7 @@ in ]; }]; }).nix-tools.components.exes.plan-to-nix; - bootstrap = if pkgs.targetPlatform.isAarch64 + bootstrap = if pkgs.targetPlatform.isAarch64 && pkgs.buildPlatform.isAarch64 then haskell-nix.bootstrap.compiler.ghc882 else haskell-nix.bootstrap.compiler.ghc844; in diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index fcea2cb721..01a77eb389 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -32,26 +32,21 @@ let # - What GHC version we should use for bootstrapping. # - What Happy version we should use for bootstrapping. buildBootstrapper = - if final.targetPlatform.isAarch64 + if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 then { - ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc882; + compilerNixName = "ghc882"; happyVersion = "1.19.12"; } else { - ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc844; + compilerNixName = "ghc844"; happyVersion = "1.19.11"; }; - # For buildPackages.buildPackages, we just care about the GHC version: - buildBuildBootstrapper = - if final.targetPlatform.isAarch64 - then final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler.ghc882 - else final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler.ghc844; in { haskell-nix = prev.haskell-nix // { # Use this to disable the existing haskell infra structure for testing purposes compiler = let bootPkgs = with final.buildPackages; { - ghc = buildBuildBootstrapper; + ghc = final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; alex = final.haskell-nix.bootstrap.packages.alex-tool { checkMaterialization = false; }; @@ -338,9 +333,9 @@ in { '' + installDeps targetPrefix); }))); - # Need to use something from 8.8.x as the default on aarch64: + # Need to use something from 8.8.x as the default to build aarch64 native compiler: defaultCompilerNixName = - if final.targetPlatform.isAarch64 + if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 then "ghc883" else "ghc865"; ghc = final.haskell-nix.compiler."${final.haskell-nix.defaultCompilerNixName}"; @@ -426,7 +421,7 @@ in { } // args); alex = final.buildPackages.haskell-nix.alex-tool {}; happy-tool = args: final.haskell-nix.tool "happy" ({ - version = buildBootstrapper.happyVersion; + version = "1.19.12"; index-state = final.haskell-nix.internalHackageIndexState; materialized = ../materialized + "/${ args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName @@ -460,7 +455,9 @@ in { # the bootstrap infra structure (pre-compiled ghc; bootstrapped cabal-install, ...) - bootstrap = with final.haskell-nix; let ghc = buildBootstrapper.ghc; in { + bootstrap = with final.haskell-nix; + let ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; + in { # XXX: import ../. will throw away all other overlays, config values, ... # this is not ideal! # get binary compilers for bootstrapping. We'll put the eventual proper @@ -492,7 +489,7 @@ in { # Only a boot compiler is suitable here ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; index-state = final.haskell-nix.internalHackageIndexState; - materialized = ../materialized/bootstrap/alex; + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex"; } // args); alex = bootstrap.packages.alex-tool {}; happy-tool = args: tool "happy" ({ @@ -501,7 +498,7 @@ in { ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; inherit (bootstrap.packages) cabal-install nix-tools hpack; index-state = final.haskell-nix.internalHackageIndexState; - materialized = ../materialized/bootstrap/happy; + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${buildBootstrapper.happyVersion}"; } // args); happy = bootstrap.packages.happy-tool {}; hscolour-tool = args: (hackage-package ({ @@ -510,7 +507,7 @@ in { # Only a boot compiler is suitable here ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; index-state = final.haskell-nix.internalHackageIndexState; - materialized = ../materialized/bootstrap/hscolour; + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour"; } // args)).components.exes.HsColour; hscolour = bootstrap.packages.hscolour-tool {}; }; diff --git a/overlays/haskell.nix b/overlays/haskell.nix index 08c9808c89..4ade1555c5 100644 --- a/overlays/haskell.nix +++ b/overlays/haskell.nix @@ -173,7 +173,7 @@ final: prev: { snapshots = import ../snapshots.nix { inherit (final) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; }; # Pick a recent LTS snapshot to be our "default" package set. haskellPackages = - if final.targetPlatform.isAarch64 + if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 then snapshots."lts-15.13" else snapshots."lts-14.13";