@@ -85,6 +85,8 @@ let self =
8585
8686# extra values we want to have available as passthru values.
8787, extra-passthru ? { }
88+
89+ , hadrianEvalPackages ? buildPackages
8890} @args :
8991
9092assert ! ( enableIntegerSimple || enableNativeBignum ) -> gmp != null ;
99101 inherit ( stdenv ) buildPlatform hostPlatform targetPlatform ;
100102 inherit ( haskell-nix . haskellLib ) isCrossTarget ;
101103
102- inherit ( bootPkgs ) ghc ;
104+ ghc = if bootPkgs . ghc . isHaskellNixCompiler or false
105+ then bootPkgs . ghc . override { inherit hadrianEvalPackages ; }
106+ else bootPkgs . ghc ;
103107
104108 ghcHasNativeBignum = builtins . compareVersions ghc-version "9.0" >= 0 ;
105109 hadrianHasNativeBignumFlavour = builtins . compareVersions ghc-version "9.6" >= 0 ;
250254 # value for us.
251255 installStage1 = useHadrian && ( with haskell-nix . haskellLib ; isCrossTarget || isNativeMusl ) ;
252256
253- hadrian =
257+ hadrianProject =
254258 let
255259 compiler-nix-name =
256260 if builtins . compareVersions ghc-version "9.4.7" < 0
@@ -259,28 +263,12 @@ let
259263 then "ghc964"
260264 else "ghc962" ;
261265 in
262- buildPackages . haskell-nix . tool compiler-nix-name "hadrian" {
266+ buildPackages . haskell-nix . cabalProject' {
267+ inherit compiler-nix-name ;
268+ name = "hadrian" ;
263269 compilerSelection = p : p . haskell . compiler ;
264270 index-state = buildPackages . haskell-nix . internalHackageIndexState ;
265- # Verions of hadrian that comes with 9.6 depends on `time`
266- materialized =
267- if builtins . compareVersions ghc-version "9.4" < 0
268- then ../../materialized/${ compiler-nix-name } /hadrian-ghc92
269- else if builtins . compareVersions ghc-version "9.4.8" < 0
270- then ../../materialized/${ compiler-nix-name } /hadrian-ghc947
271- else if builtins . compareVersions ghc-version "9.6" < 0
272- then ../../materialized/${ compiler-nix-name } /hadrian-ghc94
273- else if builtins . compareVersions ghc-version "9.6.5" < 0
274- then ../../materialized/${ compiler-nix-name } /hadrian-ghc964
275- else if builtins . compareVersions ghc-version "9.8" < 0
276- then ../../materialized/${ compiler-nix-name } /hadrian-ghc96
277- else if builtins . compareVersions ghc-version "9.8.2" < 0
278- then ../../materialized/${ compiler-nix-name } /hadrian-ghc981
279- else if builtins . compareVersions ghc-version "9.9" < 0
280- then ../../materialized/${ compiler-nix-name } /hadrian-ghc98
281- else if builtins . compareVersions ghc-version "9.11" < 0
282- then ../../materialized/${ compiler-nix-name } /hadrian-ghc910
283- else null ;
271+ evalPackages = hadrianEvalPackages ;
284272 modules = [ {
285273 reinstallableLibGhc = false ;
286274 # Apply the patches in a way that does not require using something
310298 } ;
311299 } ;
312300
301+ hadrian = hadrianProject . hsPkgs . hadrian . components . exes . hadrian ;
302+
313303 # For a discription of hadrian command line args
314304 # see https://gitlab.haskell.org/ghc/ghc/blob/master/hadrian/README.md
315305 # For build flavours and flavour transformers
389379 } ;
390380
391381in
392- stdenv . mkDerivation ( rec {
382+ haskell-nix . haskellLib . makeCompilerDeps ( stdenv . mkDerivation ( rec {
393383 version = ghc-version ;
394384 name = "${ targetPrefix } ghc-${ version } " + lib . optionalString ( useLLVM ) "-llvm" ;
395385
@@ -677,7 +667,7 @@ stdenv.mkDerivation (rec {
677667 '' ;
678668
679669 passthru = {
680- inherit bootPkgs targetPrefix libDir llvmPackages enableShared useLLVM ;
670+ inherit bootPkgs targetPrefix libDir llvmPackages enableShared useLLVM hadrian hadrianProject ;
681671
682672 # Our Cabal compiler name
683673 haskellCompilerName = "ghc-${ version } " ;
@@ -771,7 +761,9 @@ stdenv.mkDerivation (rec {
771761 smallAddressSpace = lib . makeOverridable self ( args // {
772762 disableLargeAddressSpace = true ;
773763 } ) ;
774- } // extra-passthru ;
764+ } // extra-passthru // {
765+ buildGHC = extra-passthru . buildGHC . override { inherit hadrianEvalPackages ; } ;
766+ } ;
775767
776768 meta = {
777769 homepage = "https://haskell.org/ghc" ;
@@ -915,5 +907,5 @@ stdenv.mkDerivation (rec {
915907 cd ../../..
916908 runHook postInstall
917909 '' ;
918- } ) ;
910+ } ) ) ;
919911in self
0 commit comments