Skip to content

Commit 0f430d2

Browse files
committed
Move hadrian plans into the project roots
1 parent 4520b32 commit 0f430d2

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

Diff for: build.nix

-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ in rec {
2626
} // pkgs.lib.optionalAttrs (ghcFromTo "9.13" "9.14") {
2727
cabalProjectLocal = builtins.readFile ./test/cabal.project.local;
2828
});
29-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.4" >= 0) {
30-
# Make sure the plan for hadrian is cached (we need it to instanciate ghc).
31-
hadrian-plan = pkgs.haskell-nix.compiler.${compiler-nix-name}.hadrianProject.plan-nix;
32-
# Also include the same plan evaluated on the eval system (probably x86_64-linux).
33-
hadrian-plan-eval = (pkgs.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; }).hadrianProject.plan-nix;
3429
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
3530
hlint-latest = tool compiler-nix-name "hlint" {
3631
inherit evalPackages;

Diff for: ci.nix

+2-4
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
121121
# Native builds
122122
# TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
123123
native = pkgs.recurseIntoAttrs ({
124-
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel // {
125-
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
126-
};
124+
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel
127125
} // pkgs.lib.optionalAttrs runTests {
128126
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
129127
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) rec {
@@ -143,7 +141,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
143141
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
144142
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
145143
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
146-
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel // {
144+
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel // {
147145
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
148146
};
149147
# TODO: look into cross compiling ghc itself

Diff for: overlays/haskell.nix

+14-11
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ final: prev: {
705705
inherit (callProjectResults) index-state-max;
706706
tool = final.buildPackages.haskell-nix.tool' evalPackages pkg-set.config.compiler.nix-name;
707707
tools = final.buildPackages.haskell-nix.tools' evalPackages pkg-set.config.compiler.nix-name;
708-
roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
708+
roots = final.haskell-nix.roots { inherit (pkg-set.config) compiler.nix-name; inherit evalPackages; }
709709
projectFunction = haskell-nix: haskell-nix.cabalProject';
710710
inherit projectModule buildProject;
711711
};
@@ -966,7 +966,7 @@ final: prev: {
966966
stack-nix = callProjectResults.projectNix;
967967
tool = final.buildPackages.haskell-nix.tool' evalPackages pkg-set.config.compiler.nix-name;
968968
tools = final.buildPackages.haskell-nix.tools' evalPackages pkg-set.config.compiler.nix-name;
969-
roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
969+
roots = final.haskell-nix.roots { inherit (pkg-set.config) compiler.nix-name; inherit evalPackages; }
970970
projectFunction = haskell-nix: haskell-nix.stackProject';
971971
inherit projectModule buildProject;
972972
};
@@ -1082,28 +1082,31 @@ final: prev: {
10821082
# are tested and cached. Consider using `p.roots` where `p` is a
10831083
# project as it will automatically match the `compiler-nix-name`
10841084
# of the project.
1085-
roots = compiler-nix-name: final.linkFarm "haskell-nix-roots-${compiler-nix-name}"
1085+
roots = { compiler-nix-name, evalPackages ? final.pkgsBuildBuild }: final.linkFarm "haskell-nix-roots-${compiler-nix-name}"
10861086
(final.lib.filter (x: x.name != "recurseForDerivations")
10871087
(final.lib.mapAttrsToList (name: path: { inherit name path; })
10881088
(roots' compiler-nix-name 2)));
10891089

1090-
roots' = compiler-nix-name: ifdLevel:
1090+
roots' = { compiler-nix-name, evalPackages ? final.pkgsBuildBuild }: ifdLevel: evalPackages:
1091+
let
1092+
ghc = final.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
1093+
in
10911094
final.recurseIntoAttrs ({
10921095
# Things that require no IFD to build
10931096
source-pin-hackage = hackageSrc;
10941097
source-pin-stackage = stackageSrc;
10951098
source-pin-haskell-nix = final.path;
1096-
# Double buildPackages is intentional,
1097-
# see comment in lib/default.nix for details.
1098-
# Using buildPackages rather than evalPackages so both darwin and linux
1099-
# versions will get pinned (evalPackages on darwin systems will be for darwin).
1100-
inherit (final.buildPackages.buildPackages) gitMinimal nix-prefetch-git;
1101-
inherit (final.buildPackages) nix;
1099+
inherit (evalPackages) nix gitMinimal nix-prefetch-git;
11021100
} // final.lib.optionalAttrs (final.stdenv.hostPlatform.libc == "glibc") {
11031101
inherit (final) glibcLocales;
1102+
} // pkgs.lib.optionalAttrs (builtins.compareVersions ghc.version "9.4" >= 0) {
1103+
# Make sure the plan for hadrian is cached (we need it to instanciate ghc).
1104+
hadrian-plan = final.buildPackages.haskell-nix.compiler.${compiler-nix-name}.hadrianProject.plan-nix;
1105+
# Also include the same plan evaluated on the eval system.
1106+
hadrian-plan-eval = ghc.hadrianProject.plan-nix;
11041107
} // final.lib.optionalAttrs (ifdLevel > 0) {
11051108
# Things that require one IFD to build (the inputs should be in level 0)
1106-
ghc = final.buildPackages.haskell-nix.compiler.${compiler-nix-name};
1109+
inherit ghc;
11071110
ghc-boot-packages-nix = final.recurseIntoAttrs
11081111
final.ghc-boot-packages-nix.${compiler-nix-name};
11091112
} // final.lib.optionalAttrs (ifdLevel > 1) {

0 commit comments

Comments
 (0)