Skip to content

Commit 8cfb070

Browse files
committed
Fix hadrianEvalPackages
1 parent 340ed19 commit 8cfb070

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

build.nix

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ in rec {
2828
});
2929
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.4" >= 0) {
3030
# Make sure the plan for hadrian is cached (we need it to instanciate ghc).
31-
hadrian-plan = pkgs.haskell-nix.compiler.${compiler-nix-name}.hadrian.project.plan-nix;
31+
hadrian-plan = (pkgs.haskell-nix.compiler.${compiler-nix-name}.hadrian.project.appendModule [{
32+
compilerSelection = p: builtins.mapAttrs.override { hadiranEvalPackages = evalPackages; } p.haskell-nix.compiler;
33+
}]).plan-nix;
3234
# Also include the same plan evaluated on the eval system (probably x86_64-linux).
3335
hadrian-plan-eval = (pkgs.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; }).hadrian.project.plan-nix;
3436
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {

ci.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
ghc910 = true;
6464
ghc912 = true;
6565
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
66-
ghc96 = false;
66+
ghc96 = true;
6767
ghc96X = true;
6868
ghc98 = true;
6969
ghc98llvm = false;

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

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

modules/hackage.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ in
9898
# this should allow us to use `config` overrides
9999
# in the nixpkgs setup, and properly override the
100100
# complier as needed.
101-
default = pkgs.buildPackages.haskell-nix.compiler.${config.compiler.nix-name} or (throw ''
101+
default = (pkgs.buildPackages.haskell-nix.compiler.${config.compiler.nix-name} or (throw ''
102102
This version of Nixpkgs does not contain GHC ${config.compiler.version}
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-
'');
106+
'')).override { hadrianEvalPackages = config.evalPackages; };
107107
defaultText = "pkgs.buildPackages.haskell-nix.compiler.\${config.compiler.nix-name}";
108108
};
109109

overlays/haskell.nix

+9-7
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,14 @@ final: prev: {
682682
++ (config.modules or [])
683683
++ [ {
684684
ghc.package =
685-
if config.ghcOverride != null
686-
then config.ghcOverride
687-
else if config.ghc != null
688-
then config.ghc
689-
else
690-
final.lib.mkDefault selectedCompiler;
685+
let ghc =
686+
if config.ghcOverride != null
687+
then config.ghcOverride
688+
else if config.ghc != null
689+
then config.ghc
690+
else
691+
final.lib.mkDefault selectedCompiler;
692+
in if ghc.isHaskellNixCompiler or false then ghc.override { hadrianEvalPackages = evalPackages; } else ghc;
691693
compiler.nix-name = final.lib.mkForce config.compiler-nix-name;
692694
evalPackages = final.lib.mkDefault evalPackages;
693695
} ];
@@ -950,7 +952,7 @@ final: prev: {
950952
modules = [ { _module.args.buildModules = final.lib.mkForce buildProject.pkg-set; }
951953
(mkCacheModule cache) ]
952954
++ (config.modules or [])
953-
++ final.lib.optional (config.ghc != null) { ghc.package = config.ghc; }
955+
++ final.lib.optional (config.ghc != null) { ghc.package = config.ghc.override { hadrianEvalPackages = evalPackages; }; }
954956
++ final.lib.optional (config.compiler-nix-name != null)
955957
{ compiler.nix-name = final.lib.mkForce config.compiler-nix-name; }
956958
++ [ { evalPackages = final.lib.mkDefault evalPackages; } ];

test/supported-langauges/default.nix

+1-1
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};
4+
ghc = buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
55

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

0 commit comments

Comments
 (0)