Skip to content

Commit 25027d2

Browse files
authored
Drop Hadrian Materialization (#2339)
Maintaining these plans is a bit difficult. For instance with #2338 the use of GHC 9.6.6 instead of 9.6.4 for building hadrian requires different plans for 9.8.2 and 9.8.4. Now that we are using a prebuilt static version of nix-tools, there should be less overhead in calculating these plans.
1 parent 908b3c2 commit 25027d2

File tree

446 files changed

+81
-35153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

446 files changed

+81
-35153
lines changed

ci.nix

+14-7
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;
@@ -121,12 +121,18 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
121121
# Native builds
122122
# TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
123123
native = pkgs.recurseIntoAttrs ({
124-
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
125-
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name};
124+
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel;
126125
} // pkgs.lib.optionalAttrs runTests {
127126
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
128-
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
129-
hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }).getComponent "exe:hello";
127+
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) rec {
128+
hello = (pkgs.haskell-nix.hackage-package ({ name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }
129+
// lib.optionalAttrs (builtins.compareVersions pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "9.13" >= 0) {
130+
shell.tools.hoogle.cabalProjectLocal = ''
131+
allow-newer: *:*
132+
'';
133+
})).getComponent "exe:hello";
134+
# Make sure the default shell tools (hoogle) are built
135+
simple-shell = (hello.project.flake {}).devShells.default;
130136
});
131137
}
132138
//
@@ -135,8 +141,9 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
135141
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
136142
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
137143
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
138-
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
139-
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name};
144+
roots = pkgs.haskell-nix.roots' { inherit compiler-nix-name evalPackages; } ifdLevel // {
145+
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.override { hadrianEvalPackages = evalPackages; };
146+
};
140147
# TODO: look into cross compiling ghc itself
141148
# ghc = pkgs.haskell-nix.compiler.${compiler-nix-name};
142149
# TODO: look into making tools work when cross compiling

compiler/ghc/default.nix

+18-26
Original file line numberDiff line numberDiff line change
@@ -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

9092
assert !(enableIntegerSimple || enableNativeBignum) -> gmp != null;
@@ -99,7 +101,9 @@ let
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;
@@ -250,7 +254,7 @@ let
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
@@ -310,6 +298,8 @@ let
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
@@ -389,7 +379,7 @@ let
389379
};
390380

391381
in
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+
}));
919911
in self

docs/tests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pushd tutorials
55

66
## Getting started
77
pushd getting-started
8-
nix-build
8+
nix-build -A hsPkgs.hello.components.exes.hello
99
nix-shell --pure --run "cabal build hello"
1010
popd
1111

@@ -50,4 +50,4 @@ pushd iohk-nix
5050
nix build --accept-flake-config
5151
popd
5252

53-
popd
53+
popd

docs/tutorials/development/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ in pkgs.haskell-nix.project {
2626
src = ./.;
2727
};
2828
# Specify the GHC version to use.
29-
compiler-nix-name = "ghc92"; # Not required for `stack.yaml` based projects.
29+
compiler-nix-name = "ghc96"; # Not required for `stack.yaml` based projects.
3030
}

docs/tutorials/development/nix/sources.json

+3-15
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,10 @@
55
"homepage": "https://input-output-hk.github.io/haskell.nix",
66
"owner": "input-output-hk",
77
"repo": "haskell.nix",
8-
"rev": "d61a3f429425e57108ca2b5355f10df94dafe39d",
9-
"sha256": "1fra8grb1jzfb794vm9kw090bb5kiq5g11xmb3nkm2lk60yixjx3",
8+
"rev": "3e51feeed915183f4aaca8ce7761f61e5436867c",
9+
"sha256": "18v45m7alipxvs47nfnc2hsk50gvlph8ig3x25qdp799z5d9wsp7",
1010
"type": "tarball",
11-
"url": "https://github.com/input-output-hk/haskell.nix/archive/d61a3f429425e57108ca2b5355f10df94dafe39d.tar.gz",
12-
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13-
},
14-
"nixpkgs": {
15-
"branch": "release-22.11",
16-
"description": "Nix Packages collection",
17-
"homepage": "",
18-
"owner": "NixOS",
19-
"repo": "nixpkgs",
20-
"rev": "b7ce17b1ebf600a72178f6302c77b6382d09323f",
21-
"sha256": "sha256-uNvD7fzO5hNlltNQUAFBPlcEjNG5Gkbhl/ROiX+GZU4=",
22-
"type": "tarball",
23-
"url": "https://github.com/NixOS/nixpkgs/archive/b7ce17b1ebf600a72178f6302c77b6382d09323f.tar.gz",
11+
"url": "https://github.com/input-output-hk/haskell.nix/archive/3e51feeed915183f4aaca8ce7761f61e5436867c.tar.gz",
2412
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2513
}
2614
}

docs/tutorials/getting-started-flakes/flake.nix

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
helloProject =
1313
final.haskell-nix.project' {
1414
src = ./.;
15-
compiler-nix-name = "ghc92";
15+
compiler-nix-name = "ghc96";
1616
# This is used by `nix develop .` to open a shell for use with
1717
# `cabal`, `hlint` and `haskell-language-server`
1818
shell.tools = {
1919
cabal = {};
20-
hlint = {};
21-
haskell-language-server = {};
20+
# hlint = {};
21+
# haskell-language-server = {};
2222
};
2323
# Non-Haskell shell tools go here
2424
shell.buildInputs = with pkgs; [

docs/tutorials/getting-started/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ in pkgs.haskell-nix.project {
2626
src = ./.;
2727
};
2828
# Specify the GHC version to use.
29-
compiler-nix-name = "ghc92"; # Not required for `stack.yaml` based projects.
29+
compiler-nix-name = "ghc96"; # Not required for `stack.yaml` based projects.
3030
}

docs/tutorials/getting-started/nix/sources.json

+3-15
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,10 @@
55
"homepage": "https://input-output-hk.github.io/haskell.nix",
66
"owner": "input-output-hk",
77
"repo": "haskell.nix",
8-
"rev": "d61a3f429425e57108ca2b5355f10df94dafe39d",
9-
"sha256": "1fra8grb1jzfb794vm9kw090bb5kiq5g11xmb3nkm2lk60yixjx3",
8+
"rev": "3e51feeed915183f4aaca8ce7761f61e5436867c",
9+
"sha256": "18v45m7alipxvs47nfnc2hsk50gvlph8ig3x25qdp799z5d9wsp7",
1010
"type": "tarball",
11-
"url": "https://github.com/input-output-hk/haskell.nix/archive/d61a3f429425e57108ca2b5355f10df94dafe39d.tar.gz",
12-
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13-
},
14-
"nixpkgs": {
15-
"branch": "release-21.05",
16-
"description": "Nix Packages collection",
17-
"homepage": "",
18-
"owner": "NixOS",
19-
"repo": "nixpkgs",
20-
"rev": "5f244caea76105b63d826911b2a1563d33ff1cdc",
21-
"sha256": "1xlgynfw9svy7nvh9nkxsxdzncv9hg99gbvbwv3gmrhmzc3sar75",
22-
"type": "tarball",
23-
"url": "https://github.com/NixOS/nixpkgs/archive/5f244caea76105b63d826911b2a1563d33ff1cdc.tar.gz",
11+
"url": "https://github.com/input-output-hk/haskell.nix/archive/3e51feeed915183f4aaca8ce7761f61e5436867c.tar.gz",
2412
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2513
}
2614
}
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(import ./default.nix).shellFor {
22
tools = {
33
cabal = "latest";
4-
hlint = "latest";
5-
haskell-language-server = "latest";
4+
# hlint = "latest";
5+
# haskell-language-server = "latest";
66
};
7-
}
7+
}

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
# for core of haskell.nix E.g. this should always work:
164164
# nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false
165165
roots = forEachSystem (system:
166-
self.legacyPackagesUnstable.${system}.haskell-nix.roots defaultCompiler);
166+
self.legacyPackagesUnstable.${system}.haskell-nix.roots { compiler-nix-name = defaultCompiler; });
167167

168168
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
169169
# uses IFD heavily, you have to have the ability to build for all platforms

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.

lib/make-compiler-deps.nix

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{ lib, runCommand }:
2-
let
3-
makeCompilerDeps = ghc: ghc // {
2+
ghc: ghc // {
43
cachedDeps = runCommand "${ghc.name}-deps" {}
54
# First checks that ghc-pkg runs first with `--version` as failures in the `for` and
65
# `if` statements will be masked.
@@ -34,9 +33,4 @@ let
3433
fi
3534
done
3635
'';
37-
} // lib.optionalAttrs (ghc ? dwarf) {
38-
dwarf = makeCompilerDeps ghc.dwarf;
39-
} // lib.optionalAttrs (ghc ? smallAddressSpace) {
40-
smallAddressSpace = makeCompilerDeps ghc.smallAddressSpace;
41-
};
42-
in makeCompilerDeps
36+
}

0 commit comments

Comments
 (0)