Skip to content

Fix hls build for ghc 9.2 #1592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ in rec {
"ghc884" = "3.3.6";
}.compiler-nix-name or "latest";
};
} // pkgs.lib.optionalAttrs (!__elem compiler-nix-name ["ghc921" "ghc922" "ghc923" "ghc924"]) {
hls-latest = tool compiler-nix-name "haskell-language-server" { inherit evalPackages; };
})
);
Expand Down
37 changes: 23 additions & 14 deletions modules/hackage-quirks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ let
# Easier than importing nixpkgs just for this
mapAttrsToList = f: attrs:
map (name: f name attrs.${name}) (__attrNames attrs);
in [(
{config, lib, pkgs, ...}:
in [
({config, lib, pkgs, ...}:
{ _file = "haskell.nix/overlays/hackage-quirks.nix#cabal-install"; } //
# FIXME: this is required to build cabal-install 3.2 with ghc 8.6,
# but also for
Expand All @@ -23,25 +23,34 @@ in [(
packages.cabal-install.src = pkgs.buildPackages.haskell-nix.sources.cabal-32 + "/cabal-install";
})
];
})]
}
)

# TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
# See https://github.com/haskell/haskell-language-server/issues/2969
# and https://github.com/obsidiansystems/dependent-sum/issues/71
({config, lib, pkgs, ...}:
{ _file = "haskell.nix/overlays/hackage-quirks.nix#haskell-language-server"; } //
lib.mkIf (config.name == "haskell-language-server") {
cabalProject = lib.mkDefault (''
packages: .
constraints: dependent-sum >=0.7.1.0
''
# TODO Remove this flag once the hls-haddock-comments-plugin is updated in hackage to work with ghc 9.2
+ lib.optionalString (__elem config.compiler-nix-name ["ghc921" "ghc922" "ghc923" "ghc924"]) ''
package haskell-language-server
flags: -haddockcomments
'');
}
)

# Map the following into modules that use `mkIf` to check the name of the
# hackage package in a way that is lazy enought not to cause infinite recursion
# issues.
++ mapAttrsToList (n: v: {config, lib, ...}:
] ++ mapAttrsToList (n: v: {config, lib, ...}:
{ _file = "haskell.nix/overlays/hackage-quirks.nix#${n}"; } //
lib.mkIf (n == config.name) v) {

# TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
# See https://github.com/haskell/haskell-language-server/issues/2969
# and https://github.com/obsidiansystems/dependent-sum/issues/71
haskell-language-server = {
cabalProject = ''
packages: .
constraints: dependent-sum >=0.7.1.0
'';
};

lsp-test = {
cabalProject = ''
packages: .
Expand Down
4 changes: 2 additions & 2 deletions test/haskell-language-server/cabal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ in recurseIntoAttrs {
};
build = project.getComponent "haskell-language-server:exe:haskell-language-server";

# Haskell Language Server in hackage does not build for GHC 9.2 yet
meta.disabled = __elem compiler-nix-name ["ghc921" "ghc922" "ghc923" "ghc924"] || stdenv.hostPlatform != stdenv.buildPlatform;
# hls does not need to be cross compiled.
meta.disabled = stdenv.hostPlatform != stdenv.buildPlatform;
}