Skip to content

Commit

Permalink
Add GHC 9.12.1 (#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack authored Jan 7, 2025
1 parent c8f91dd commit 9261dd9
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 49 deletions.
2 changes: 1 addition & 1 deletion build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ in rec {
pkgs.recurseIntoAttrs ({
cabal-latest = tool compiler-nix-name "cabal" ({
inherit evalPackages;
} // pkgs.lib.optionalAttrs (ghcFromTo "9.12" "9.13") {
} // pkgs.lib.optionalAttrs (ghcFromTo "9.13" "9.14") {
cabalProjectLocal = builtins.readFile ./test/cabal.project.local;
});
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
Expand Down
1 change: 1 addition & 0 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
ghc98llvm = false;
ghc910 = true;
ghc910llvm = true;
ghc9121 = true;
ghc912X = true;
ghc913 = true;
})));
Expand Down
1 change: 1 addition & 0 deletions lazy-inputs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ in {
inherit ((callFlake { pkgs = final; src = ./ghc983; }).defaultNix) ghc983;
inherit ((callFlake { pkgs = final; src = ./ghc984; }).defaultNix) ghc984;
inherit ((callFlake { pkgs = final; src = ./ghc9101; }).defaultNix) ghc9101;
inherit ((callFlake { pkgs = final; src = ./ghc9121; }).defaultNix) ghc9121;
inherit ((callFlake { pkgs = final; src = ./ghc912X; }).defaultNix) ghc912X;
inherit ((callFlake { pkgs = final; src = ./ghc913; }).defaultNix) ghc913;
} // prev.haskell-nix.sources;
Expand Down
30 changes: 30 additions & 0 deletions lazy-inputs/ghc9121/flake.lock

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

12 changes: 12 additions & 0 deletions lazy-inputs/ghc9121/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
description = "Lazy Input for Haskell.nix";

inputs = {
ghc9121 = {
flake = false;
url = "git+https://github.com/stable-haskell/ghc?ref=ghc-9.12.1-iog&submodules=1";
};
};

outputs = inputs: inputs;
}
8 changes: 4 additions & 4 deletions lazy-inputs/ghc912X/flake.lock

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

8 changes: 4 additions & 4 deletions lazy-inputs/ghc913/flake.lock

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

10 changes: 5 additions & 5 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,18 @@ let
json_cabal_file=$(mktemp)
cabal2json $fixed_cabal_file > $json_cabal_file
exposed_modules="$(jq -r '.library."exposed-modules"[]|select(type=="array")[]' $json_cabal_file)"
reexported_modules="$(jq -r '.library."reexported-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file)"
exposed_modules="$(jq -r '.library."exposed-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file)"
reexported_modules="$(jq -r '.library."reexported-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file | sed 's/.* as //g')"
# FIXME This is a bandaid. Rather than doing this, conditionals should be interpreted.
${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isGhcjs ''
exposed_modules+=" $(jq -r '.library."exposed-modules"[]|select(type=="object" and .if.arch == "javascript")|.then[]' $json_cabal_file)"
exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.arch == "javascript")|.then[]' $json_cabal_file)"
''}
${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isWindows ''
exposed_modules+=" $(jq -r '.library."exposed-modules"[]|select(type=="object" and .if.os == "windows")|.then[]' $json_cabal_file)"
exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.os == "windows")|.then[]' $json_cabal_file)"
''}
${pkgs.lib.optionalString (!pkgs.stdenv.targetPlatform.isWindows) ''
exposed_modules+=" $(jq -r '.library."exposed-modules"[]|select(type=="object" and .if.not.os == "windows")|.then[]' $json_cabal_file)"
exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.not.os == "windows")|.then[]' $json_cabal_file)"
''}
EXPOSED_MODULES_${varname name}="$(tr '\n' ' ' <<< "$exposed_modules $reexported_modules")"
Expand Down
41 changes: 38 additions & 3 deletions overlays/bootstrap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ let
"9.6" = "9.6.6";
"9.8" = "9.8.4";
"9.10" = "9.10.1";
"9.12" = "9.12.1";
};
gitInputs = {
ghc912X = "9.12.0";
ghc912X = "9.12.1";
ghc913 = "9.13";
};
versionToNixName = v: "ghc${builtins.replaceStrings ["."] [""] v}";
Expand Down Expand Up @@ -911,6 +912,38 @@ in {

ghc-patches = ghc-patches "9.10.1";
});
ghc9121 = traceWarnOld "9.12" (final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc9121; };

bootPkgs = bootPkgsGhc94 // {
ghc = if final.stdenv.buildPlatform != final.stdenv.targetPlatform
then final.buildPackages.buildPackages.haskell-nix.compiler.ghc9121
else final.buildPackages.buildPackages.haskell.compiler.ghc9121
or final.buildPackages.buildPackages.haskell.compiler.ghc9101
or final.buildPackages.buildPackages.haskell.compiler.ghc984
or final.buildPackages.buildPackages.haskell.compiler.ghc983
or final.buildPackages.buildPackages.haskell.compiler.ghc982
or final.buildPackages.buildPackages.haskell.compiler.ghc981
or final.buildPackages.buildPackages.haskell.compiler.ghc966
or final.buildPackages.buildPackages.haskell.compiler.ghc965
or final.buildPackages.buildPackages.haskell.compiler.ghc964
or final.buildPackages.buildPackages.haskell.compiler.ghc963
or final.buildPackages.buildPackages.haskell.compiler.ghc962
or final.buildPackages.buildPackages.haskell.compiler.ghc945
or final.buildPackages.buildPackages.haskell.compiler.ghc944
or final.buildPackages.buildPackages.haskell.compiler.ghc943;
};
inherit sphinx;

buildLlvmPackages = final.buildPackages.llvmPackages_15;
llvmPackages = final.llvmPackages_15;

src-spec.file = final.haskell-nix.sources.ghc9121;
src-spec.version = "9.12.1";
src-spec.needsBooting = true;

ghc-patches = ghc-patches "9.12.1";
});
} // (__listToAttrs (final.lib.mapAttrsToList (source-name: ver:
let
src = final.haskell-nix.sources.${source-name};
Expand All @@ -924,8 +957,10 @@ in {

bootPkgs = bootPkgsGhc94 // {
ghc = if final.stdenv.buildPlatform != final.stdenv.targetPlatform
then final.buildPackages.buildPackages.haskell-nix.compiler.ghc9101 # TODO use ${compiler-nix-name}
else final.buildPackages.buildPackages.haskell.compiler.ghc984
then final.buildPackages.buildPackages.haskell-nix.compiler.ghc9121
else final.buildPackages.buildPackages.haskell.compiler.ghc9121
or final.buildPackages.buildPackages.haskell.compiler.ghc9101
or final.buildPackages.buildPackages.haskell.compiler.ghc984
or final.buildPackages.buildPackages.haskell.compiler.ghc983
or final.buildPackages.buildPackages.haskell.compiler.ghc982
or final.buildPackages.buildPackages.haskell.compiler.ghc981
Expand Down
23 changes: 9 additions & 14 deletions test/cabal.project.local
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
if impl(ghc>=9.10.1)
if impl(ghc>=9.12.1)
-- allow newer packages, that are bound to be newer due to
-- being shipped with a newer compiler. If you extend this
-- be very careful to only extend it for absolutely necessary packages
-- otherwise we risk running into broken build-plans down the line.
allow-newer: *:base, *:template-haskell, *:bytestring, *:text, *:ghc-prim, *:deepseq, *:Cabal
allow-newer: *:base, *:template-haskell, *:ghc-prim

if impl(ghc > 9.11)
allow-newer: *:containers, *:time
if impl(ghc > 9.13)
allow-newer: *:containers, *:time, *:ghc-bignum
constraints: base-compat >=0.14.0, aeson >=2.2.1.0
-- From https://ghc.gitlab.haskell.org/head.hackage/cabal.constraints
constraints: extra ==1.7.14

if impl(ghc >9.13)
constraints: base-orphans <0.9.3 || >0.9.3

-- This prevents hsc2hs from causing old versions of packages from being added to plan.json
allow-newer: hsc2hs:*

if impl(ghc >=9.10.1)
extra-packages: process

repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
Expand All @@ -28,7 +23,7 @@ repository head.hackage.ghc.haskell.org
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
--sha256: sha256-EQKpiiwoIXiM7r+bGYvQzB4vWANqO6PJaSUlt1NUIeI=
--sha256: sha256-RQS0PUBA6nAD1T0OSVFhcF7ldh+6L+cW+k96Hgo3z5s=

repository ghcjs-overlay
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ffb32dce467b9a4d27be759fdd2740a6edd09d0b
Expand All @@ -41,14 +36,14 @@ if os(ghcjs)
extra-packages: ghci
constraints: ghci installed

if !impl(ghc>=9.11) && !os(ghcjs)
if !impl(ghc>=9.13) && !os(ghcjs)
active-repositories: hackage.haskell.org

if impl(ghc>=9.11) && !os(ghcjs)
if impl(ghc>=9.13) && !os(ghcjs)
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org

if !impl(ghc>=9.11) && os(ghcjs)
if !impl(ghc>=9.13) && os(ghcjs)
active-repositories: hackage.haskell.org, ghcjs-overlay:override

if impl(ghc>=9.11) && os(ghcjs)
if impl(ghc>=9.13) && os(ghcjs)
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org, ghcjs-overlay:override
8 changes: 1 addition & 7 deletions test/gi-gtk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ let
inherit compiler-nix-name evalPackages;
src = testSrc "gi-gtk";
cabalProjectLocal = builtins.readFile ../cabal.project.local + ''
-- haskell-gi 0.26.12 breaks gi-gtkpixbuf
index-state: 2024-09-30T00:00:00Z
-- The overloading feature of haskell-gi makes build times very long
constraints: haskell-gi-overloading ==0.0
if impl(ghc >=9.11)
constraints: filepath source
'';
};

Expand All @@ -29,9 +25,7 @@ in recurseIntoAttrs rec {
# error: incompatible pointer to integer conversion assigning to 'ffi_arg' (aka 'unsigned long') from 'HsPtr' (aka 'void *') [-Wint-conversion]
|| builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc928" "ghc948"] && stdenv.hostPlatform.isAarch64
# Cross compilation to aarch64 is also broken
|| stdenv.hostPlatform.isAarch64 && !stdenv.buildPlatform.isAarch64
# Building profiled version of Cabal for haskell-gi is currently broken for GHC head
|| compiler-nix-name == "ghc91320241204";
|| stdenv.hostPlatform.isAarch64 && !stdenv.buildPlatform.isAarch64;

ifdInputs = {
inherit (project) plan-nix;
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ in recurseIntoAttrs {

# Not sure why this breaks for ghc 8.10.7
meta.disabled = compiler-nix-name == "ghc8107"
|| builtins.elem compiler-nix-name [ "ghc912020241128" "ghc91320241204" ]
|| builtins.elem compiler-nix-name [ "ghc9121" "ghc912120241215" "ghc91320241230" ]
|| stdenv.hostPlatform.isMusl
|| stdenv.hostPlatform.isGhcjs
|| stdenv.hostPlatform.isWindows
Expand Down
21 changes: 11 additions & 10 deletions test/th-dlls/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,29 @@ in recurseIntoAttrs {
meta.disabled = stdenv.hostPlatform.isGhcjs
# On aarch64 this test also breaks form musl builds (including cross compiles on x86_64-linux)
|| (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isMusl)
# On for aarch64 cross compile on GHC 9.8.4 this test is fails sometimes for non profiled builds
# (and always for the profiled builds).
# This may be related to the memory allocation changes made in 9.8.4 that
# replace the pool allocator patches we used in earlier versions.
|| (compiler-nix-name == "ghc984" && stdenv.buildPlatform.isx86_64 && stdenv.hostPlatform.isAarch64)
# Failed to lookup symbol: __aarch64_swp8_acq_rel
|| (builtins.elem compiler-nix-name ["ghc947" "ghc948"] && haskellLib.isCrossHost && stdenv.hostPlatform.isAarch64)
# We have been unable to get windows cross compilation of th-orphans to work for GHC 8.10 using the latest nixpkgs
|| (compiler-nix-name == "ghc8107" && stdenv.hostPlatform.isWindows)
# We need to update GHC HEAD to get a version of ghc-internal compatible
# with th-lift from head.hackage.
|| builtins.elem compiler-nix-name [ "ghc91320241204" ]
;

ifdInputs = {
inherit (project true) plan-nix;
};

build = packages.th-dlls.components.library;
build-profiled = packages.th-dlls.components.library.profiled;
just-template-haskell = packages.th-dlls.components.exes.just-template-haskell;
build-ei = packages-ei.th-dlls.components.library;
build-profiled-ei = packages-ei.th-dlls.components.library.profiled;
just-template-haskell-ei = packages-ei.th-dlls.components.exes.just-template-haskell;
} // optionalAttrs
(!(builtins.elem compiler-nix-name ["ghc984" "ghc9121" "ghc912120241215"] && stdenv.buildPlatform.isx86_64 && stdenv.hostPlatform.isAarch64)) {
# On for aarch64 cross compile on GHC this test is fails sometimes for non profiled builds
# (and always for the profiled builds).
# This may be related to the memory allocation changes made in 9.8.4 that
# replace the pool allocator patches we used in earlier versions.

# Interestingly GHC 9.10.1 and HEAD are wotking while 9.8.4 and 9.12 seem break.
# Perhaps there is a fix in GHC HEAD?
build-profiled = packages.th-dlls.components.library.profiled;
build-profiled-ei = packages-ei.th-dlls.components.library.profiled;
}

0 comments on commit 9261dd9

Please sign in to comment.