Skip to content

Use haskell.nix in for hadrian #2040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions nix-tools/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];

Expand Down Expand Up @@ -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:
Expand Down
21 changes: 18 additions & 3 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down