Skip to content

Commit 220155e

Browse files
committed
s/hadrianEvalPackages/toolEvalPackages and add comments
1 parent 8896595 commit 220155e

File tree

7 files changed

+22
-13
lines changed

7 files changed

+22
-13
lines changed

ci.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
155155
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
156156
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
157157
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel // {
158-
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
158+
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { toolEvalPackages = evalPackages; };
159159
};
160160
# TODO: look into cross compiling ghc itself
161161
# ghc = pkgs.haskell-nix.compiler.${compiler-nix-name};

compiler/ghc/default.nix

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,16 @@ let self =
8686
# extra values we want to have available as passthru values.
8787
, extra-passthru ? {}
8888

89-
, hadrianEvalPackages ? buildPackages
89+
# For running IFDs (used to evaluate build plans of tools involved in building GHC).
90+
#
91+
# Currently used for:
92+
# * hadrian
93+
# * libffi-wasm
94+
# * cabal (if we start using `cabal` to build GHC)
95+
#
96+
# We use this instead of `buildPackages` so that plan evaluation
97+
# can work on platforms other than the `buildPlatform`.
98+
, toolEvalPackages ? buildPackages, toolEvalPackages ? buildPackages
9099
}@args:
91100

92101
assert !(enableIntegerSimple || enableNativeBignum) -> gmp != null;
@@ -104,7 +113,7 @@ let
104113
inherit (haskell-nix.haskellLib) isCrossTarget;
105114

106115
ghc = if bootPkgs.ghc.isHaskellNixCompiler or false
107-
then bootPkgs.ghc.override { inherit hadrianEvalPackages; }
116+
then bootPkgs.ghc.override { inherit toolEvalPackages; }
108117
else bootPkgs.ghc;
109118

110119
ghcHasNativeBignum = builtins.compareVersions ghc-version "9.0" >= 0;
@@ -125,7 +134,7 @@ let
125134
nativeBuildInputs = [
126135
(buildPackages.haskell-nix.tool "ghc912" "libffi-wasm" {
127136
src = buildPackages.haskell-nix.sources.libffi-wasm;
128-
evalPackages = hadrianEvalPackages;
137+
evalPackages = toolEvalPackages;
129138
})
130139
targetPackages.buildPackages.llvmPackages.clang
131140
targetPackages.buildPackages.llvmPackages.llvm
@@ -316,7 +325,7 @@ let
316325
inherit compiler-nix-name;
317326
name = "hadrian";
318327
compilerSelection = p: p.haskell.compiler;
319-
evalPackages = hadrianEvalPackages;
328+
evalPackages = toolEvalPackages;
320329
modules = [{
321330
reinstallableLibGhc = false;
322331
# Apply the patches in a way that does not require using something
@@ -887,7 +896,7 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
887896
disableLargeAddressSpace = true;
888897
});
889898
} // extra-passthru // {
890-
buildGHC = extra-passthru.buildGHC.override { inherit hadrianEvalPackages; };
899+
buildGHC = extra-passthru.buildGHC.override { inherit toolEvalPackages; };
891900
};
892901

893902
meta = {

lib/call-cabal-project-to-nix.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
, cabalProjectLocal ? null
1515
, cabalProjectFreeze ? null
1616
, caller ? "callCabalProjectToNix" # Name of the calling function for better warning messages
17-
, compilerSelection ? p: builtins.mapAttrs (_: x: x.override { hadrianEvalPackages = evalPackages; }) p.haskell-nix.compiler
17+
, compilerSelection ? p: builtins.mapAttrs (_: x: x.override { toolEvalPackages = evalPackages; }) p.haskell-nix.compiler
1818
, ghcOverride ? null # Used when we need to set ghc explicitly during bootstrapping
1919
, configureArgs ? "" # Extra arguments to pass to `cabal v2-configure`.
2020
# `--enable-tests --enable-benchmarks` are included by default.

modules/cabal-project.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ in {
2222
};
2323
compilerSelection = mkOption {
2424
type = unspecified;
25-
default = p: builtins.mapAttrs (_: x: x.override { hadrianEvalPackages = config.evalPackages; }) p.haskell-nix.compiler;
25+
default = p: builtins.mapAttrs (_: x: x.override { toolEvalPackages = config.evalPackages; }) p.haskell-nix.compiler;
2626
description = "Use GHC from pkgs.haskell instead of pkgs.haskell-nix";
2727
};
2828
index-state = mkOption {

modules/hackage.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ in
103103
(or it is not present at attribute '${config.compiler.nix-name})').
104104
Either switch to a version of Nixpkgs which does have this version, or use a version
105105
of GHC which the current version of Nixpkgs contains.
106-
'')).override { hadrianEvalPackages = config.evalPackages; };
106+
'')).override { toolEvalPackages = config.evalPackages; };
107107
defaultText = "pkgs.buildPackages.haskell-nix.compiler.\${config.compiler.nix-name}";
108108
};
109109

overlays/haskell.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ final: prev: {
696696
then config.ghc
697697
else
698698
final.lib.mkDefault selectedCompiler;
699-
in if ghc.isHaskellNixCompiler or false then ghc.override { hadrianEvalPackages = evalPackages; } else ghc;
699+
in if ghc.isHaskellNixCompiler or false then ghc.override { toolEvalPackages = evalPackages; } else ghc;
700700
compiler.nix-name = final.lib.mkForce config.compiler-nix-name;
701701
evalPackages = final.lib.mkDefault evalPackages;
702702
} ];
@@ -947,7 +947,7 @@ final: prev: {
947947
modules = [ { _module.args.buildModules = final.lib.mkForce buildProject.pkg-set; }
948948
(mkCacheModule cache) ]
949949
++ (config.modules or [])
950-
++ final.lib.optional (config.ghc != null) { ghc.package = config.ghc.override { hadrianEvalPackages = evalPackages; }; }
950+
++ final.lib.optional (config.ghc != null) { ghc.package = config.ghc.override { toolEvalPackages = evalPackages; }; }
951951
++ final.lib.optional (config.compiler-nix-name != null)
952952
{ compiler.nix-name = final.lib.mkForce config.compiler-nix-name; }
953953
++ [ { evalPackages = final.lib.mkDefault evalPackages; } ];
@@ -1151,7 +1151,7 @@ final: prev: {
11511151

11521152
roots' = { compiler-nix-name, evalPackages ? final.pkgsBuildBuild }: ifdLevel:
11531153
let
1154-
ghc = final.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
1154+
ghc = final.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { toolEvalPackages = evalPackages; };
11551155
in
11561156
final.recurseIntoAttrs ({
11571157
# Things that require no IFD to build

test/supported-langauges/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ stdenv, pkgs, lib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }:
22

33
let
4-
ghc = buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
4+
ghc = buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { toolEvalPackages = evalPackages; };
55

66
supported-langauges = import ../../lib/supported-languages.nix {
77
inherit pkgs evalPackages ghc;

0 commit comments

Comments
 (0)