diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index 04b94b3c06..d3c372b8d4 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -239,7 +239,7 @@ let # value for us. installStage1 = useHadrian && (haskell-nix.haskellLib.isCrossTarget || stdenv.targetPlatform.isMusl); - hadrian = buildPackages.haskell-nix.tool "ghc8107" "hadrian" { + hadrian = buildPackages.pinned-haskell-nix.tool "ghc8107" "hadrian" { compilerSelection = p: p.haskell.compiler; index-state = buildPackages.haskell-nix.internalHackageIndexState; # Verions of hadrian that comes with 9.6 depends on `time` diff --git a/flake.nix b/flake.nix index 083b3f5774..df4d13ace3 100644 --- a/flake.nix +++ b/flake.nix @@ -156,7 +156,15 @@ let legacyPackages = (self.internal.compat { inherit system; }).pkgs; nix-tools-hydraJobs = - let cf = callFlake { pkgs = legacyPackages; inherit system; src = ./nix-tools; }; + let cf = callFlake { + pkgs = legacyPackages; + inherit system; + src = ./nix-tools; + override-inputs = { + # Avoid downloading another `hackage.nix`. + inherit (inputs) hackage; + }; + }; in cf.defaultNix.hydraJobs; in rec { inherit legacyPackages; diff --git a/nix-tools/flake.nix b/nix-tools/flake.nix index 457665bde5..1bb25c8e1b 100644 --- a/nix-tools/flake.nix +++ b/nix-tools/flake.nix @@ -7,8 +7,7 @@ systems = [ "x86_64-linux" "x86_64-darwin" - # TODO switch back on when ci.iog.io has builders for aarch64-linux - # "aarch64-linux" + "aarch64-linux" "aarch64-darwin" ]; @@ -48,6 +47,10 @@ legacyPackages = forAllSystems (pkgs: pkgs); + lib = { + nix-tools = system: (haskellNix.legacyPackages.${system}.extend self.overlays.default).nix-tools; + haskell-nix = system: (haskellNix.legacyPackages.${system}.extend self.overlays.default).haskell-nix; + }; project = forAllSystems (pkgs: pkgs.nix-tools.project); packages = forAllSystems (pkgs: diff --git a/overlays/default.nix b/overlays/default.nix index 38d2d3e35c..2911470dcb 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -43,16 +43,31 @@ let # add the missing exes attributes to the tarball derivation tarball // { exes = final.lib.genAttrs nix-tools-provided-exes (_: tarball); }; - # Are we going to use the tarball? - use-tarball = final.stdenv.hostPlatform.isLinux && final.stdenv.hostPlatform.isx86_64; + # Version of nix-tools built with a pinned version of haskell.nix. + pinned-nix-tools-lib = (import (final.haskell-nix.sources.flake-compat) { + pkgs = final; + inherit (final) system; + src = ../nix-tools; + override-inputs = { + # Avoid downloading another `hackage.nix`. + inherit (final.haskell-nix.sources) hackage; + }; + }).defaultNix.lib; in { haskell-nix = prev.haskell-nix // { inherit (nix-tools-pkgs) nix-tools nix-tools-set; # either nix-tools from its overlay or from the tarball. - nix-tools-unchecked = if use-tarball then static-nix-tools else nix-tools-pkgs.nix-tools; + nix-tools-unchecked = + # If possible use the static nix-tools tarball + if final.stdenv.hostPlatform.isLinux && final.stdenv.hostPlatform.isx86_64 + then static-nix-tools + else pinned-nix-tools-lib.nix-tools final.system; }; + # For use building hadrian. This way updating anything that modifies the + # way hadrian is built will not cause a GHC rebuild. + pinned-haskell-nix = pinned-nix-tools-lib.haskell-nix final.system; }); bootstrap = import ./bootstrap.nix;