@@ -85,6 +85,8 @@ let self =
85
85
86
86
# extra values we want to have available as passthru values.
87
87
, extra-passthru ? { }
88
+
89
+ , hadrianEvalPackages ? buildPackages
88
90
} @args :
89
91
90
92
assert ! ( enableIntegerSimple || enableNativeBignum ) -> gmp != null ;
99
101
inherit ( stdenv ) buildPlatform hostPlatform targetPlatform ;
100
102
inherit ( haskell-nix . haskellLib ) isCrossTarget ;
101
103
102
- inherit ( bootPkgs ) ghc ;
104
+ ghc = if bootPkgs . ghc . isHaskellNixCompiler or false
105
+ then bootPkgs . ghc . override { inherit hadrianEvalPackages ; }
106
+ else bootPkgs . ghc ;
103
107
104
108
ghcHasNativeBignum = builtins . compareVersions ghc-version "9.0" >= 0 ;
105
109
hadrianHasNativeBignumFlavour = builtins . compareVersions ghc-version "9.6" >= 0 ;
250
254
# value for us.
251
255
installStage1 = useHadrian && ( with haskell-nix . haskellLib ; isCrossTarget || isNativeMusl ) ;
252
256
253
- hadrian =
257
+ hadrianProject =
254
258
let
255
259
compiler-nix-name =
256
260
if builtins . compareVersions ghc-version "9.4.7" < 0
@@ -259,28 +263,12 @@ let
259
263
then "ghc964"
260
264
else "ghc962" ;
261
265
in
262
- buildPackages . haskell-nix . tool compiler-nix-name "hadrian" {
266
+ buildPackages . haskell-nix . cabalProject' {
267
+ inherit compiler-nix-name ;
268
+ name = "hadrian" ;
263
269
compilerSelection = p : p . haskell . compiler ;
264
270
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 ;
284
272
modules = [ {
285
273
reinstallableLibGhc = false ;
286
274
# Apply the patches in a way that does not require using something
310
298
} ;
311
299
} ;
312
300
301
+ hadrian = hadrianProject . hsPkgs . hadrian . components . exes . hadrian ;
302
+
313
303
# For a discription of hadrian command line args
314
304
# see https://gitlab.haskell.org/ghc/ghc/blob/master/hadrian/README.md
315
305
# For build flavours and flavour transformers
389
379
} ;
390
380
391
381
in
392
- stdenv . mkDerivation ( rec {
382
+ haskell-nix . haskellLib . makeCompilerDeps ( stdenv . mkDerivation ( rec {
393
383
version = ghc-version ;
394
384
name = "${ targetPrefix } ghc-${ version } " + lib . optionalString ( useLLVM ) "-llvm" ;
395
385
@@ -677,7 +667,7 @@ stdenv.mkDerivation (rec {
677
667
'' ;
678
668
679
669
passthru = {
680
- inherit bootPkgs targetPrefix libDir llvmPackages enableShared useLLVM ;
670
+ inherit bootPkgs targetPrefix libDir llvmPackages enableShared useLLVM hadrian hadrianProject ;
681
671
682
672
# Our Cabal compiler name
683
673
haskellCompilerName = "ghc-${ version } " ;
@@ -771,7 +761,9 @@ stdenv.mkDerivation (rec {
771
761
smallAddressSpace = lib . makeOverridable self ( args // {
772
762
disableLargeAddressSpace = true ;
773
763
} ) ;
774
- } // extra-passthru ;
764
+ } // extra-passthru // {
765
+ buildGHC = extra-passthru . buildGHC . override { inherit hadrianEvalPackages ; } ;
766
+ } ;
775
767
776
768
meta = {
777
769
homepage = "https://haskell.org/ghc" ;
@@ -915,5 +907,5 @@ stdenv.mkDerivation (rec {
915
907
cd ../../..
916
908
runHook postInstall
917
909
'' ;
918
- } ) ;
910
+ } ) ) ;
919
911
in self
0 commit comments