Skip to content

Commit

Permalink
Add HLS 2.4 and bump ghc98 and ghc99 get versions (#2088)
Browse files Browse the repository at this point in the history
* Add HLS 2.4 and bump ghc98 and ghc99 get versions

* ifdLevel 2

* Fixes

* Bump ghc99 and fix eval

* Fix for windows cross

* Use ghc 9.6 to build hadrian

* Materialized files

* ifdLevel 2

* ifdLevel 1

* ifdLevel 2

* Fix for hls

* Fix issue with musl version for git compilers

* ifdLevel 2

* ifdLevel 3
  • Loading branch information
hamishmack authored Oct 14, 2023
1 parent 59067c3 commit f4cdb22
Show file tree
Hide file tree
Showing 98 changed files with 7,288 additions and 84 deletions.
39 changes: 28 additions & 11 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,9 @@ in rec {
version = "2.11.1";
inherit evalPackages;
};
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
"hls-110" = tool compiler-nix-name "haskell-language-server" {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-1.10";
};
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
"hls-20" = tool compiler-nix-name "haskell-language-server" {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-2.0";
};
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" < 0) {
# This version will build for ghc < 9.8, but we are only going to test it for
# ghc < 9.0 (since newer versions do not work with ghc 8.10.7).
"hls-22" = tool compiler-nix-name "haskell-language-server" {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-2.2";
Expand All @@ -74,6 +66,31 @@ in rec {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-2.3";
};
} // pkgs.lib.optionalAttrs (
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" >= 0 &&
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.9" < 0
) {
"hls-24" = tool compiler-nix-name "haskell-language-server" {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-2.4";
# Even though this is in the cabal.project it is inside a condional
# and so haskell.nix cannot parse it properly. Luckily adding it
# again seems to work fine.
cabalProjectLocal = ''
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
key-threshold: 3
root-keys:
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
--sha256: sha256-aVI93DtHziicNn2mGli0YE+bC5BeT7mOQQETp2Thi68=
if impl(ghc < 9.7)
active-repositories: hackage.haskell.org
'';
};
})
);

Expand Down
73 changes: 28 additions & 45 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
"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 @@ -47,23 +44,10 @@
};
};

compilerNixNames = nixpkgsName: nixpkgs:
# Include only the GHC versions that are supported by haskell.nix
nixpkgs.lib.filterAttrs (compiler-nix-name: _:
# We have less x86_64-darwin build capacity so build fewer GhC versions
(system != "x86_64-darwin" || (
!builtins.elem compiler-nix-name ["ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
&&
# aarch64-darwin requires ghc 8.10.7
(system != "aarch64-darwin" || (
!builtins.elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
&&
# aarch64-linux requires ghc 8.8.4
(system != "aarch64-linux" || (
!builtins.elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
)))
(builtins.mapAttrs (_compiler-nix-name: runTests: {
inherit runTests;
compilerNixNames = nixpkgsName: nixpkgs: builtins.listToAttrs (
(lib.mapAttrsToList (compiler-nix-name: runTests: {
name = nixpkgs.haskell-nix.resolve-compiler-name compiler-nix-name;
value = { inherit runTests; };
}) (
# GHC version to cache and whether to run the tests against them.
# This list of GHC versions should include everything for which we
Expand All @@ -72,50 +56,49 @@
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
# Update supported-ghc-versions.md to reflect any changes made here.
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2305") {
ghc8107 = false;
ghc902 = false;
ghc928 = false;
ghc947 = false;
ghc963 = false;
ghc981 = false;
ghc810 = false;
ghc90 = false;
ghc92 = false;
ghc94 = false;
ghc96 = false;
ghc98 = false;
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
ghc884 = false;
ghc8107 = true;
ghc902 = false;
ghc928 = true;
ghc947 = true;
ghc963 = true;
ghc981 = true;
${ghc980X nixpkgs} = true;
${ghc99X nixpkgs} = true;
}));
ghc810 = true;
ghc90 = false;
ghc92 = true;
ghc94 = true;
ghc96 = true;
ghc98 = true;
ghc98X = true;
ghc99 = 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" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)])
|| (system == "aarch64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)])
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)])
|| (system == "aarch64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)])
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
)) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (nixpkgsName == "unstable"
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc947" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)])
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884"])
|| (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 (nixpkgsName == "unstable"
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc947" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)])
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928"])
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
inherit (lib.systems.examples) ucrt64;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc947" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)]) {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884"]) {
# 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" "ghc963" "ghc981" (ghc980X nixpkgs) (ghc99X nixpkgs)]) {
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902"]) {
inherit (lib.systems.examples) aarch64-multiplatform-musl;
};
isDisabled = d: d.meta.disabled or false;
Expand All @@ -134,7 +117,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name};
} // pkgs.lib.optionalAttrs runTests {
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
} // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
} // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
inherit (pkgs.haskell-nix.iserv-proxy-exes.${compiler-nix-name}) iserv-proxy;
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }).getComponent "exe:hello";
Expand Down
8 changes: 5 additions & 3 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ let

hadrian =
let
compiler-nix-name = if buildPackages.haskell.compiler ? "ghc928"
then "ghc928"
else "ghc8107";
compiler-nix-name =
if buildPackages.haskell.compiler ? "ghc962" then "ghc962"
else throw "Expected pkgs.haskell.compiler.ghc962 for building hadrian";
in buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" {
compilerSelection = p: p.haskell.compiler;
index-state = buildPackages.haskell-nix.internalHackageIndexState;
Expand Down Expand Up @@ -436,9 +436,11 @@ stdenv.mkDerivation (rec {
done
'' + lib.optionalString (src-spec.version != ghc-version) ''
substituteInPlace configure --replace 'RELEASE=YES' 'RELEASE=NO'
substituteInPlace configure.ac --replace 'RELEASE=YES' 'RELEASE=NO'
echo '${ghc-version}' > VERSION
'' + lib.optionalString (ghc-version-date != null) ''
substituteInPlace configure --replace 'RELEASE=YES' 'RELEASE=NO'
substituteInPlace configure.ac --replace 'RELEASE=YES' 'RELEASE=NO'
echo '${ghc-version-date}' > VERSION_DATE
'' + lib.optionalString (ghc-commit-id != null) ''
echo '${ghc-commit-id}' > GIT_COMMIT_ID
Expand Down
38 changes: 28 additions & 10 deletions flake.lock

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

3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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 = {
ghc98X = {
flake = false;
url = "git+https://gitlab.haskell.org/ghc/ghc?ref=ghc-9.8&submodules=1";
};
Expand All @@ -23,6 +23,7 @@
"hls-2.0" = { url = "github:haskell/haskell-language-server/2.0.0.1"; flake = false; };
"hls-2.2" = { url = "github:haskell/haskell-language-server/2.2.0.0"; flake = false; };
"hls-2.3" = { url = "github:haskell/haskell-language-server/2.3.0.0"; flake = false; };
"hls-2.4" = { url = "github:haskell/haskell-language-server/2.4.0.0"; flake = false; };
hydra.url = "hydra";
hackage = {
url = "github:input-output-hk/hackage.nix";
Expand Down
Loading

0 comments on commit f4cdb22

Please sign in to comment.