Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
b4576a4
Add `ghc980` and `ghc99`
hamishmack Aug 8, 2023
0539716
Use gitlab for ghc
hamishmack Aug 9, 2023
f61c8df
Avoid restricted eval issue
hamishmack Aug 9, 2023
1380ce4
Remove forced check
hamishmack Aug 9, 2023
0c4fdde
Add materialization
hamishmack Aug 9, 2023
0b059e7
Use nixpkgs ghc to build cabal-install for use at eval time
hamishmack Aug 9, 2023
6c8ee7e
Add hadrian plan materialization
hamishmack Aug 9, 2023
ad43dde
ifdLevel 0
hamishmack Aug 9, 2023
445a433
Use full compiler-nix-name in ci
hamishmack Aug 9, 2023
28647aa
Fix for new ghc with old nixpkgs
hamishmack Aug 9, 2023
82668d2
Avoid ghc chain
hamishmack Aug 10, 2023
e8e4d34
Avoid ghc chain
hamishmack Aug 10, 2023
5987057
Avoid ghc chain
hamishmack Aug 10, 2023
3635b09
Turn of materialization check
hamishmack Aug 10, 2023
94d733f
ifdLevel 1
hamishmack Aug 10, 2023
a61741f
Fix iserv-proxy for ghc 9.8
hamishmack Aug 10, 2023
5672394
More materialization fixes
hamishmack Aug 10, 2023
432bdaa
Add ghc-platform to ghc-packages.nix
hamishmack Aug 10, 2023
7c4cd5c
Only ghc 9.9 has ghc-platform
hamishmack Aug 10, 2023
a6a4976
Remove broken postConfigure code
hamishmack Aug 10, 2023
66eb598
ifdLevel 2
hamishmack Aug 10, 2023
d027b6a
Fix cabal-install
hamishmack Aug 10, 2023
0efc41f
ifdLevel 0
hamishmack Aug 10, 2023
1a93208
ifdLevel 1
hamishmack Aug 10, 2023
45d4693
ifdLevel 2
hamishmack Aug 10, 2023
deffba3
Test fixes
hamishmack Aug 11, 2023
60fe53b
More fixes
hamishmack Aug 11, 2023
6cc5f18
ifdLevel 3
hamishmack Aug 11, 2023
c3b7d5d
More fixes
hamishmack Aug 11, 2023
6d77aba
Another fix
hamishmack Aug 11, 2023
3c07d3f
Fix tests that depend on lens
hamishmack Aug 11, 2023
0384da9
Use https://ghc.gitlab.haskell.org/head.hackage/
hamishmack Aug 11, 2023
215b9bc
Use https://ghc.gitlab.haskell.org/head.hackage/
hamishmack Aug 11, 2023
7008a66
Use https://ghc.gitlab.haskell.org/head.hackage/
hamishmack Aug 11, 2023
19e9a45
Test fix
hamishmack Aug 14, 2023
3005815
Test fixes
hamishmack Aug 14, 2023
d14ca60
Test fixes
hamishmack Aug 14, 2023
5c0e21d
Test fixes
hamishmack Aug 14, 2023
5969e86
Fix extra-hackage test
hamishmack Aug 14, 2023
d7897f5
Fix building ghcjs
hamishmack Aug 14, 2023
ddfff3d
Add missing quotes
hamishmack Aug 14, 2023
8a7352e
ifdLevel 1
hamishmack Aug 14, 2023
da96f21
Remove patch now merged in ghc git branches
hamishmack Aug 14, 2023
3438630
Build cross compilers with same version
hamishmack Aug 14, 2023
f3bd575
Stick with ghc962 for build cross compilers
hamishmack Aug 14, 2023
3de92ce
Stick with ghc962 for build cross compilers
hamishmack Aug 14, 2023
25f7fbf
Bump ghc git pins
hamishmack Aug 15, 2023
f0a0b61
ifdLevel 0
hamishmack Aug 15, 2023
3d9c05d
Add patch for windows cross
hamishmack Aug 15, 2023
3b5fe20
ifdLevel 1
hamishmack Aug 15, 2023
9735bbf
ifdLevel 2
hamishmack Aug 15, 2023
fc8972c
ifdLevel 3
hamishmack Aug 15, 2023
7b1307f
Fix exe extension for ghcjs
hamishmack Aug 16, 2023
3749663
ghcjs fix
hamishmack Aug 16, 2023
04c83f4
ghcjs test fix
hamishmack Aug 16, 2023
e3a010b
ghcjs test fix
hamishmack Aug 16, 2023
724b24a
Add missing /
hamishmack Aug 16, 2023
84fdb84
Mark tests as broken
hamishmack Aug 16, 2023
5e60b20
Mark tests as broken
hamishmack Aug 16, 2023
2587ead
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Aug 18, 2023
bc70d67
Fix for ghc9820230704
hamishmack Aug 18, 2023
965c62e
Fix for missing `ld` command
hamishmack Aug 18, 2023
79e9a57
Fix for ghcjs
hamishmack Aug 18, 2023
2e76124
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Aug 22, 2023
18bbdb5
Fix duplicate Stack.o symbols
hamishmack Aug 22, 2023
5c5d21d
Bump head.hackage
hamishmack Aug 22, 2023
a4471c2
ifdLevel 1
hamishmack Aug 22, 2023
77061cf
ifdLevel 0
hamishmack Aug 22, 2023
69226d9
ifdLevel 1
hamishmack Aug 23, 2023
aded5d5
ifdLevel 2
hamishmack Aug 23, 2023
a010b78
ifdLevel 3
hamishmack Aug 23, 2023
c908658
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Aug 23, 2023
c36e42b
ifdLevel 0
hamishmack Aug 23, 2023
7a5c658
ifdLevel 1
hamishmack Aug 23, 2023
14cd413
ifdLevel 2
hamishmack Aug 23, 2023
56932ad
ifdLevel 3
hamishmack Aug 23, 2023
1eb0670
Enable ghcjs tests
hamishmack Aug 25, 2023
2fef92a
Fix for ghcjs
hamishmack Aug 25, 2023
896644d
Clunky temp work around for ghcjs-overlay test
hamishmack Aug 25, 2023
c086506
Fix for ghcjs-overlay test
hamishmack Aug 25, 2023
bafbad6
Add cabalProjectCompiler
hamishmack Aug 25, 2023
d9c7571
Add cabalProjectCompiler
hamishmack Aug 25, 2023
c081474
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Aug 28, 2023
46d7389
Use `dontUpdateAutotoolsGnuConfigScripts` for ghcjs
hamishmack Aug 29, 2023
07549c7
Try without setting `active-repositories`
hamishmack Aug 29, 2023
9f7bfc3
Swap repo order
hamishmack Aug 29, 2023
fe8ab14
Include `extra-hackage-tarballs` in `active-repositories`
hamishmack Aug 29, 2023
e9fc9fb
Fix merge error
hamishmack Aug 29, 2023
43f660a
constraints: setup.Cabal >=3.10
hamishmack Aug 31, 2023
76f7a77
Leave out daily updates for now
hamishmack Aug 31, 2023
a8b440e
Fix for ghcOptions and js backend of ghc
hamishmack Aug 31, 2023
b890dd9
Disable still broken ghcjs tests
hamishmack Aug 31, 2023
8f912ea
Fixes for constraints: Cabal >=3.10
hamishmack Aug 31, 2023
98ccd21
ifdLevel 2
hamishmack Aug 31, 2023
49c8a7b
ifdLevel 3
hamishmack Aug 31, 2023
dfe2257
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Aug 31, 2023
29b0121
Fix hls tests
hamishmack Aug 31, 2023
74ec9fb
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Sep 1, 2023
27948c6
Revert constraints: setup.Cabal >=3.10
hamishmack Sep 1, 2023
d0ee070
Bump ghc git inputs
hamishmack Sep 2, 2023
d4330c9
Remove unnecessary patch
hamishmack Sep 2, 2023
bf367cd
ifdLevel 1
hamishmack Sep 2, 2023
815a0cb
Fixes for latest ghc HEAD
hamishmack Sep 2, 2023
8610edd
Remove unnecessary patch
hamishmack Sep 2, 2023
d3f3742
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Sep 5, 2023
dd91191
Fix merge issue
hamishmack Sep 5, 2023
29e6467
Fix hydra eval
hamishmack Sep 5, 2023
c47e2a6
Include cabal fix in ghc99
hamishmack Sep 5, 2023
7d2d4f4
Include cabal fix in ghc99
hamishmack Sep 5, 2023
4352e25
Include cabal fix in ghc99
hamishmack Sep 6, 2023
6523636
ifdLevel 2
hamishmack Sep 6, 2023
608e6f7
Use `cabal` from `nix-tools`
hamishmack Sep 6, 2023
ec252bf
Use `defaultSetupFor` to pick correct setup
hamishmack Sep 6, 2023
492bd34
ifdLevel 3
hamishmack Sep 6, 2023
69182e5
Prevent building cabal 3.10.1.0 with ghc head
hamishmack Sep 7, 2023
51d55ed
Add ghc-internal to nonReinstallablePkgs
hamishmack Sep 7, 2023
f4f4e04
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Sep 8, 2023
ac7ec46
Update head.hackage
hamishmack Sep 8, 2023
239ba84
Skip patches that don't apply
hamishmack Sep 8, 2023
a65eb68
Fix call-cabal-project-to-nix test
hamishmack Sep 10, 2023
cac63bb
Add containers and bytestring to nonReinstallablePkgs for now
hamishmack Sep 10, 2023
c25b73a
Handle new error output format
hamishmack Sep 11, 2023
a57544b
Merge remote-tracking branch 'origin/master' into hkm/ghcgit
hamishmack Sep 11, 2023
654fc27
Fix comment
hamishmack Sep 11, 2023
de3b5a4
Remove unused patch (comes from head.hackage now)
hamishmack Sep 11, 2023
1f39648
Add comments
hamishmack Sep 11, 2023
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
15 changes: 6 additions & 9 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ in rec {
"ghc8107" = "3.4.1";
}.${compiler-nix-name} or "latest";
};
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
} // pkgs.lib.optionalAttrs (
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.2" >= 0
&& __compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
stack =
tool compiler-nix-name "stack" {
version =
if __compareVersions haskell.compiler.${compiler-nix-name}.version "9.2" < 0
then "2.9.3.1"
else "2.11.1";
version = "2.11.1";
inherit evalPackages;
};
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
Expand Down Expand Up @@ -78,17 +77,15 @@ in rec {
update-hackage = import ./scripts/update-hackage.nix {
inherit (pkgs) stdenv lib writeScript coreutils glibc git
openssh nixFlakes gawk bash curl findutils;
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
# Update scripts use the internal nix-tools (compiled with a fixed GHC version)
nix-tools = haskell.nix-tools-unchecked;
cabal-install = haskell.internal-cabal-install;
inherit (haskell) update-index-state-hashes cabal-issue-8352-workaround;
};
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
inherit (pkgs) stdenv lib writeScript coreutils glibc git
openssh nixFlakes gawk bash curl findutils;
# Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version)
# Update scripts use the internal nix-tools (compiled with a fixed GHC version)
nix-tools = haskell.nix-tools-unchecked;
cabal-install = haskell.internal-cabal-install;
inherit (haskell) cabal-issue-8352-workaround;
};
update-pins = haskell.callPackage ./scripts/update-pins.nix {};
Expand Down
31 changes: 22 additions & 9 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let self =

, dontPatchELF ? component.dontPatchELF
, dontStrip ? component.dontStrip
, dontUpdateAutotoolsGnuConfigScripts ? component.dontUpdateAutotoolsGnuConfigScripts
, hardeningDisable ? component.hardeningDisable

, enableStatic ? component.enableStatic
Expand Down Expand Up @@ -187,15 +188,23 @@ let
"--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
"--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
]
) ++ [ # other flags
) # Starting with ghc 9.10 the `ld command` will no longer be in the GHC `settings` file.
# We need to start passing it explicitly to setup like we do for `ar` and `strip`.
++ lib.optional (!stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" >= 0)
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
++ lib.optionals (stdenv.hostPlatform.isGhcjs) [
"--with-gcc=${buildPackages.emscripten}/bin/emcc"
"--with-ld=${buildPackages.emscripten}/bin/emcc"
]
++ [ # other flags
(disableFeature dontStrip "executable-stripping")
(disableFeature dontStrip "library-stripping")
(enableFeature enableLibraryProfiling "library-profiling")
(enableFeature enableProfiling "profiling")
(enableFeature enableStatic "static")
(enableFeature enableShared "shared")
(enableFeature doCoverage "coverage")
(enableFeature enableLibraryForGhci "library-for-ghci")
(enableFeature (enableLibraryForGhci && !stdenv.hostPlatform.isGhcjs) "library-for-ghci")
] ++ lib.optionals (stdenv.hostPlatform.isMusl && (haskellLib.isExecutableType componentId)) [
# These flags will make sure the resulting executable is statically linked.
# If it uses other libraries it may be necessary for to add more
Expand All @@ -222,7 +231,7 @@ let
++ lib.optionals useLLVM [
"--ghc-option=-fPIC" "--gcc-option=-fPIC"
]
++ map (o: ''--ghc${lib.optionalString stdenv.hostPlatform.isGhcjs "js"}-options="${o}"'') ghcOptions
++ map (o: ''--ghc${lib.optionalString (stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9" < 0) "js"}-options="${o}"'') ghcOptions
++ lib.optional (
# GHC 9.2 cross compiler built with older versions of GHC seem to have problems
# with unique conters. Perhaps because the name changed for the counters.
Expand Down Expand Up @@ -260,8 +269,9 @@ let
if builtins.isFunction shellHook then shellHook { inherit package shellWrappers; }
else abort "shellHook should be a string or a function";

exeExt = if stdenv.hostPlatform.isGhcjs then ".jsexe/all.js" else
stdenv.hostPlatform.extensions.executable;
exeExt = if stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" < 0
then ".jsexe/all.js"
else stdenv.hostPlatform.extensions.executable;
exeName = componentId.cname + exeExt;
testExecutable = "dist/build/${componentId.cname}/${exeName}";

Expand Down Expand Up @@ -317,6 +327,9 @@ let
// lib.optionalAttrs stdenv.hostPlatform.isMusl {
# This fixes musl compilation of TH code that depends on C++ (for instance TH code that uses the double-conversion package)
LD_LIBRARY_PATH="${pkgs.buildPackages.gcc-unwrapped.lib}/x86_64-unknown-linux-musl/lib";
}
// lib.optionalAttrs dontUpdateAutotoolsGnuConfigScripts {
inherit dontUpdateAutotoolsGnuConfigScripts;
};

haddock = haddockBuilder {
Expand Down Expand Up @@ -531,7 +544,7 @@ let
# we assume that if the SETUP_HS command fails and the following line was found in the error
# log, that it was the only error. Hence if we do _not_ find the line, grep will fail and this derivation
# will be marked as failure.
cat $SETUP_ERR | grep 'Error: Setup: No executables and no library found\. Nothing to do\.'
cat $SETUP_ERR | grep 'No executables and no library found\. Nothing to do\.'
fi
''}
${lib.optionalString (haskellLib.isLibrary componentId) ''
Expand Down Expand Up @@ -583,13 +596,13 @@ let
'')
}
''}
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId) ''
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || (haskellLib.isExe componentId && stdenv.hostPlatform.isGhcjs)) ''
mkdir -p $out/bin
if [ -f ${testExecutable} ]; then
mkdir -p $(dirname $out/bin/${exeName})
${lib.optionalString stdenv.buildPlatform.isLinux "sync"}
${if stdenv.hostPlatform.isGhcjs then ''
cat <(echo \#!${lib.getBin buildPackages.nodejs-18_x}/bin/node) ${testExecutable} >| $out/bin/${exeName}
${if stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" < 0 then ''
cat <(echo \#!/usr/bin/env node) ${testExecutable} >| $out/bin/${exeName}
chmod +x $out/bin/${exeName}
'' else ''
cp -r ${testExecutable} $(dirname $out/bin/${exeName})
Expand Down
25 changes: 15 additions & 10 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"unstable" = inputs.nixpkgs-unstable;
};

ghc980X = pkgs: "ghc980${__substring 0 8 pkgs.haskell-nix.sources.ghc980.lastModifiedDate}";
ghc99X = pkgs: "ghc99${__substring 0 8 pkgs.haskell-nix.sources.ghc99.lastModifiedDate}";

nixpkgsArgs = {
# set checkMaterialization as per top-level argument
overlays = [
Expand All @@ -49,15 +52,15 @@
nixpkgs.lib.filterAttrs (compiler-nix-name: _:
# We have less x86_64-darwin build capacity so build fewer GhC versions
(system != "x86_64-darwin" || (
!__elem compiler-nix-name ["ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
!builtins.elem compiler-nix-name ["ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
&&
# aarch64-darwin requires ghc 8.10.7
(system != "aarch64-darwin" || (
!__elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
!builtins.elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
&&
# aarch64-linux requires ghc 8.8.4
(system != "aarch64-linux" || (
!__elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
!builtins.elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
)))
(builtins.mapAttrs (compiler-nix-name: runTests: {
inherit runTests;
Expand Down Expand Up @@ -87,30 +90,32 @@
ghc947 = true;
ghc962 = true;
ghc9820230704 = true;
${ghc980X nixpkgs} = true;
${ghc99X nixpkgs} = true;
}));
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
# We need to use the actual nixpkgs version we're working with here, since the values
# of 'lib.systems.examples' are not understood between all versions
let lib = nixpkgs.lib;
in lib.optionalAttrs (nixpkgsName == "unstable"
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
|| (system == "aarch64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
|| (system == "aarch64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
|| (system == "aarch64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
|| (system == "aarch64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
)) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (nixpkgsName == "unstable"
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc947" "ghc962" "ghc9820230704"])
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc947" "ghc962" (ghc980X nixpkgs) (ghc980X nixpkgs)])
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
inherit (lib.systems.examples) mingwW64;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc947" "ghc962" "ghc9820230704"]) {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc947" "ghc962" (ghc980X nixpkgs) (ghc980X nixpkgs)]) {
# Musl cross only works on linux
# aarch64 cross only works on linux
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928"]) {
# TODO fix this for the compilers we build with hadrian (ghc >=9.4)
inherit (lib.systems.examples) aarch64-multiplatform-musl;
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928" "ghc947" "ghc962" "ghc9820230704"]) {
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928" "ghc947" "ghc962" (ghc980X nixpkgs) (ghc980X nixpkgs)]) {
inherit (lib.systems.examples) aarch64-multiplatform-musl;
};
isDisabled = d: d.meta.disabled or false;
Expand Down
30 changes: 19 additions & 11 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ let self =

, ghc-version ? src-spec.version
, ghc-version-date ? null
, ghc-commit-id ? null
, src-spec
, ghc-patches ? []

Expand Down Expand Up @@ -239,18 +240,25 @@ let
# value for us.
installStage1 = useHadrian && (haskell-nix.haskellLib.isCrossTarget || stdenv.targetPlatform.isMusl);

hadrian = buildPackages.pinned-haskell-nix.tool "ghc8107" "hadrian" {
hadrian =
let
compiler-nix-name = if buildPackages.haskell.compiler ? "ghc928"
then "ghc928"
else "ghc8107";
in buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" {
compilerSelection = p: p.haskell.compiler;
index-state = buildPackages.haskell-nix.internalHackageIndexState;
# Verions of hadrian that comes with 9.6 depends on `time`
materialized =
if builtins.compareVersions ghc-version "9.4" < 0
then ../../materialized/ghc8107/hadrian-ghc92
then ../../materialized/${compiler-nix-name}/hadrian-ghc92
else if builtins.compareVersions ghc-version "9.6" < 0
then ../../materialized/ghc8107/hadrian-ghc94
then ../../materialized/${compiler-nix-name}/hadrian-ghc94
else if builtins.compareVersions ghc-version "9.8" < 0
then ../../materialized/ghc8107/hadrian-ghc96
else ../../materialized/ghc8107/hadrian-ghc98;
then ../../materialized/${compiler-nix-name}/hadrian-ghc96
else if builtins.compareVersions ghc-version "9.9" < 0
then ../../materialized/${compiler-nix-name}/hadrian-ghc98
else ../../materialized/${compiler-nix-name}/hadrian-ghc99;
modules = [{
# Apply the patches in a way that does not require using something
# like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run
Expand All @@ -263,10 +271,6 @@ let
cd hadrian
'';
}];
cabalProject = ''
packages:
.
'';
cabalProjectLocal = null;
cabalProjectFreeze = null;
src = haskell-nix.haskellLib.cleanSourceWith {
Expand All @@ -278,6 +282,7 @@ let
filterPath = { path, ... }: path;
};
subDir = "hadrian";
includeSiblings = true;
};
};

Expand Down Expand Up @@ -372,6 +377,7 @@ stdenv.mkDerivation (rec {
export CC="${targetCC}/bin/emcc"
export CXX="${targetCC}/bin/em++"
export LD="${targetCC}/bin/emcc"
export NM="${targetCC}/share/emscripten/emnm"
export EM_CACHE=$(mktemp -d)
mv config.sub.ghcjs config.sub
''
Expand Down Expand Up @@ -434,9 +440,11 @@ stdenv.mkDerivation (rec {
'' + lib.optionalString (ghc-version-date != null) ''
substituteInPlace configure --replace 'RELEASE=YES' 'RELEASE=NO'
echo '${ghc-version-date}' > VERSION_DATE
'' + lib.optionalString (ghc-commit-id != null) ''
echo '${ghc-commit-id}' > GIT_COMMIT_ID
''
# The official ghc 9.2.3 tarball requires booting.
+ lib.optionalString (ghc-version == "9.2.3" || ghc-version == "9.8.20230704") ''
+ lib.optionalString (ghc-version == "9.2.3" || ghc-version == "9.8.20230704" || src-spec.needsBooting or false) ''
python3 ./boot
'';

Expand Down Expand Up @@ -644,7 +652,7 @@ stdenv.mkDerivation (rec {
for a in libraries/*/*.cabal.in utils/*/*.cabal.in compiler/ghc.cabal.in; do
${hadrian}/bin/hadrian ${hadrianArgs} "''${a%.*}"
done
'' + lib.optionalString (builtins.compareVersions ghc-version "9.8.1" >= 0) ''
'' + lib.optionalString (ghc-version == "9.8.20230704") ''
for a in bytearray-access-ops.txt.pp addr-access-ops.txt.pp primops.txt; do
${hadrian}/bin/hadrian ${hadrianArgs} _build/stage0/compiler/build/$a
cp _build/stage0/compiler/build/$a compiler/GHC/Builtin/$a
Expand Down
47 changes: 43 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
nixpkgs-2211 = { url = "github:NixOS/nixpkgs/nixpkgs-22.11-darwin"; };
nixpkgs-2305 = { url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin"; };
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
ghc980 = {
flake = false;
url = "git+https://gitlab.haskell.org/ghc/ghc?ref=ghc-9.8&submodules=1";
};
ghc99 = {
flake = false;
url = "git+https://gitlab.haskell.org/ghc/ghc?submodules=1";
};
flake-compat = { url = "github:input-output-hk/flake-compat/hkm/gitlab-fix"; flake = false; };
"hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; };
"hls-2.0" = { url = "github:haskell/haskell-language-server/2.0.0.1"; flake = false; };
Expand Down
5 changes: 5 additions & 0 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, cabalProjectFileName ? "cabal.project"
, cabalProject ? null
, cabalProjectLocal ? null
, cabalProjectDefaults ? null
, cabalProjectFreeze ? null
, caller ? "callCabalProjectToNix" # Name of the calling function for better warning messages
, compilerSelection ? p: p.haskell-nix.compiler
Expand Down Expand Up @@ -138,6 +139,10 @@ in let
-- Added from `cabalProjectLocal` argument to the `cabalProject` function
${cabalProjectLocal}
''
+ pkgs.lib.optionalString (cabalProjectDefaults != null) ''
-- Added from `cabalProjectDefaults` argument to the `cabalProject` function
${cabalProjectDefaults}
''
}
'';

Expand Down
Loading