Skip to content

Commit 954b73f

Browse files
committed
Fix arm cross compilation
1 parent 41acf90 commit 954b73f

File tree

10 files changed

+18
-20
lines changed

10 files changed

+18
-20
lines changed

materialized/bootstrap/hscolour/default.nix renamed to materialized/bootstrap/ghc844/hscolour/default.nix

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix-tools/regenerate.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ in
5555
];
5656
}];
5757
}).nix-tools.components.exes.plan-to-nix;
58-
bootstrap = if pkgs.targetPlatform.isAarch64
58+
bootstrap = if pkgs.targetPlatform.isAarch64 && pkgs.buildPlatform.isAarch64
5959
then haskell-nix.bootstrap.compiler.ghc882
6060
else haskell-nix.bootstrap.compiler.ghc844;
6161
in

overlays/bootstrap.nix

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,21 @@ let
3232
# - What GHC version we should use for bootstrapping.
3333
# - What Happy version we should use for bootstrapping.
3434
buildBootstrapper =
35-
if final.targetPlatform.isAarch64
35+
if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
3636
then {
37-
ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc882;
37+
compilerNixName = "ghc882";
3838
happyVersion = "1.19.12";
3939
}
4040
else {
41-
ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc844;
41+
compilerNixName = "ghc844";
4242
happyVersion = "1.19.11";
4343
};
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;
4944
in {
5045
haskell-nix = prev.haskell-nix // {
5146
# Use this to disable the existing haskell infra structure for testing purposes
5247
compiler =
5348
let bootPkgs = with final.buildPackages; {
54-
ghc = buildBuildBootstrapper;
49+
ghc = final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
5550
alex = final.haskell-nix.bootstrap.packages.alex-tool {
5651
checkMaterialization = false;
5752
};
@@ -338,9 +333,9 @@ in {
338333
'' + installDeps targetPrefix);
339334
})));
340335

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:
342337
defaultCompilerNixName =
343-
if final.targetPlatform.isAarch64
338+
if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
344339
then "ghc883"
345340
else "ghc865";
346341
ghc = final.haskell-nix.compiler."${final.haskell-nix.defaultCompilerNixName}";
@@ -426,7 +421,7 @@ in {
426421
} // args);
427422
alex = final.buildPackages.haskell-nix.alex-tool {};
428423
happy-tool = args: final.haskell-nix.tool "happy" ({
429-
version = buildBootstrapper.happyVersion;
424+
version = "1.19.12";
430425
index-state = final.haskell-nix.internalHackageIndexState;
431426
materialized = ../materialized + "/${
432427
args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName
@@ -460,7 +455,9 @@ in {
460455

461456

462457
# 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 {
464461
# XXX: import ../. will throw away all other overlays, config values, ...
465462
# this is not ideal!
466463
# get binary compilers for bootstrapping. We'll put the eventual proper
@@ -492,7 +489,7 @@ in {
492489
# Only a boot compiler is suitable here
493490
ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
494491
index-state = final.haskell-nix.internalHackageIndexState;
495-
materialized = ../materialized/bootstrap/alex;
492+
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
496493
} // args);
497494
alex = bootstrap.packages.alex-tool {};
498495
happy-tool = args: tool "happy" ({
@@ -501,7 +498,7 @@ in {
501498
ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
502499
inherit (bootstrap.packages) cabal-install nix-tools hpack;
503500
index-state = final.haskell-nix.internalHackageIndexState;
504-
materialized = ../materialized/bootstrap/happy;
501+
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${buildBootstrapper.happyVersion}";
505502
} // args);
506503
happy = bootstrap.packages.happy-tool {};
507504
hscolour-tool = args: (hackage-package ({
@@ -510,7 +507,7 @@ in {
510507
# Only a boot compiler is suitable here
511508
ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
512509
index-state = final.haskell-nix.internalHackageIndexState;
513-
materialized = ../materialized/bootstrap/hscolour;
510+
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
514511
} // args)).components.exes.HsColour;
515512
hscolour = bootstrap.packages.hscolour-tool {};
516513
};

overlays/haskell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ final: prev: {
173173
snapshots = import ../snapshots.nix { inherit (final) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; };
174174
# Pick a recent LTS snapshot to be our "default" package set.
175175
haskellPackages =
176-
if final.targetPlatform.isAarch64
176+
if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
177177
then snapshots."lts-15.13"
178178
else snapshots."lts-14.13";
179179

release.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluting
22
# on a machine with e.g. no way to build the Darwin IFDs you need!
33
{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
4-
, ifdLevel ? 3 }:
4+
, ifdLevel ? 1 }:
55

66
let
77
inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations;

0 commit comments

Comments
 (0)