From 954b73f9350ce64b1065f68f37c86f45db775191 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 5 Jun 2020 23:54:15 +1200 Subject: [PATCH 1/3] Fix arm cross compilation --- .../{ => ghc844}/alex/.plan.nix/alex.nix | 0 .../bootstrap/{ => ghc844}/alex/default.nix | 0 .../happy-1.19.11}/.plan.nix/happy.nix | 0 .../happy-1.19.11}/default.nix | 0 .../hscolour/.plan.nix/hscolour.nix | 0 .../{ => ghc844}/hscolour/default.nix | 3 +- nix-tools/regenerate.nix | 2 +- overlays/bootstrap.nix | 29 +++++++++---------- overlays/haskell.nix | 2 +- release.nix | 2 +- 10 files changed, 18 insertions(+), 20 deletions(-) rename materialized/bootstrap/{ => ghc844}/alex/.plan.nix/alex.nix (100%) rename materialized/bootstrap/{ => ghc844}/alex/default.nix (100%) rename materialized/bootstrap/{happy => ghc844/happy-1.19.11}/.plan.nix/happy.nix (100%) rename materialized/bootstrap/{happy => ghc844/happy-1.19.11}/default.nix (100%) rename materialized/bootstrap/{ => ghc844}/hscolour/.plan.nix/hscolour.nix (100%) rename materialized/bootstrap/{ => ghc844}/hscolour/default.nix (99%) 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"; diff --git a/release.nix b/release.nix index 90c7399554..df945b84e1 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluting # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 3 }: +, ifdLevel ? 1 }: let inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations; From 0d35e657dead2034479c3fb23df05640e543f2f6 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Jun 2020 00:15:40 +1200 Subject: [PATCH 2/3] ifdLevel 2 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index df945b84e1..e9a67d7035 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluting # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 1 }: +, ifdLevel ? 2 }: let inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations; From 70cd7e92cb2bbe9523a19ac10b071475054a70ec Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 6 Jun 2020 02:56:15 +1200 Subject: [PATCH 3/3] ifdLevel 3 --- release.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.nix b/release.nix index e9a67d7035..90c7399554 100644 --- a/release.nix +++ b/release.nix @@ -1,7 +1,7 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluting # on a machine with e.g. no way to build the Darwin IFDs you need! { supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] -, ifdLevel ? 2 }: +, ifdLevel ? 3 }: let inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations;