Skip to content

Commit

Permalink
Fix tools for ghc >=9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Oct 16, 2023
1 parent e8174fc commit a31d477
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions cross-windows.nix
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ pkgs.pkgsBuildBuild.mkShell ({
stdenv.cc
pkgsBuildBuild.haskell-nix.cabal-install.${compiler-nix-name}
(pkgsBuildBuild.pkg-config or pkgsBuildBuild.pkgconfig)
(pkgsBuildBuild.haskell-nix.tool compiler-nix-name "happy" "1.20.1.1")
(pkgsBuildBuild.haskell-nix.tool compiler-nix-name "alex" "3.2.7.3")
(tool "happy")
(tool "alex")
stdenv.cc.cc.lib ])
++ pkgs.lib.optional (withHLS && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.9" >= 0) compiler-nix-name
Expand Down
35 changes: 20 additions & 15 deletions tool-map.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# see https://haskell-language-server.readthedocs.io/en/latest/support/ghc-version-support.html
# so we assume "latest" for all hls.
# for hlint however, we need hlint-3.3 for ghc-8.10.7.
let fixed-versions = { "hlint" = { "ghc8107" = { version = "3.4.1"; }; "ghc902" = { version = "3.5"; }; }; }; in
compiler-nix-name: tool: {
# for HLS, we rely on the cabal.project configuration from the upstream project to have the correct configuration.
# Building HLS from hackage requires setting all those constraints as well, and just isn't practical to do for each
# HLS release. Therefore we rely on the HLS upstream repository to provide the proper configuration information.
haskell-language-server = {pkgs, ...}: rec {
# Use the github source of HLS that is tested with haskell.nix CI
src = { "ghc8107" = pkgs.haskell-nix.sources."hls-2.2"; }.${compiler-nix-name} or pkgs.haskell-nix.sources."hls-2.4";
# `tool` normally ignores the `cabal.project` (if there is one in the hackage source).
# We need to use the github one (since it has settings to make hls build).
cabalProject = __readFile (src + "/cabal.project");
cabalProjectLocal = ''
let
fixed-versions = { "hlint" = { "ghc8107" = { version = "3.4.1"; }; "ghc902" = { version = "3.5"; }; }; };
cabalProjectLocal = ''
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
Expand All @@ -25,10 +16,24 @@ compiler-nix-name: tool: {
if impl(ghc < 9.7)
active-repositories: hackage.haskell.org
'';
else
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org
'';
in
compiler-nix-name: tool: {
# for HLS, we rely on the cabal.project configuration from the upstream project to have the correct configuration.
# Building HLS from hackage requires setting all those constraints as well, and just isn't practical to do for each
# HLS release. Therefore we rely on the HLS upstream repository to provide the proper configuration information.
haskell-language-server = {pkgs, ...}: rec {
# Use the github source of HLS that is tested with haskell.nix CI
src = { "ghc8107" = pkgs.haskell-nix.sources."hls-2.2"; }.${compiler-nix-name} or pkgs.haskell-nix.sources."hls-2.4";
# `tool` normally ignores the `cabal.project` (if there is one in the hackage source).
# We need to use the github one (since it has settings to make hls build).
cabalProject = __readFile (src + "/cabal.project");
inherit cabalProjectLocal;
# sha256 for a `source-repository-package` in the `cabal.project` file.
sha256map."https://github.com/pepeiborra/ekg-json"."7a0af7a8fd38045fd15fb13445bdcc7085325460" = "sha256-fVwKxGgM0S4Kv/4egVAAiAjV7QB5PBqMVMCfsv7otIQ=";
};
happy = { version = "1.20.1.1"; };
alex = { version = "3.2.7.3"; };
happy = { version = "1.20.1.1"; inherit cabalProjectLocal; };
alex = { version = "3.2.7.3"; inherit cabalProjectLocal; };
}.${tool} or fixed-versions.${tool}.${compiler-nix-name} or {}

0 comments on commit a31d477

Please sign in to comment.