Skip to content

Commit fe7d738

Browse files
authored
Fix hls build for ghc 9.2 (#1592)
This adds `flags: -haddockcomments` to the default cabal.project of haskell-language-server to fix building on ghc 9.2
1 parent 1662092 commit fe7d738

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

Diff for: build.nix

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ in rec {
3434
"ghc884" = "3.3.6";
3535
}.compiler-nix-name or "latest";
3636
};
37-
} // pkgs.lib.optionalAttrs (!__elem compiler-nix-name ["ghc921" "ghc922" "ghc923" "ghc924"]) {
3837
hls-latest = tool compiler-nix-name "haskell-language-server" { inherit evalPackages; };
3938
})
4039
);

Diff for: modules/hackage-quirks.nix

+23-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ let
55
# Easier than importing nixpkgs just for this
66
mapAttrsToList = f: attrs:
77
map (name: f name attrs.${name}) (__attrNames attrs);
8-
in [(
9-
{config, lib, pkgs, ...}:
8+
in [
9+
({config, lib, pkgs, ...}:
1010
{ _file = "haskell.nix/overlays/hackage-quirks.nix#cabal-install"; } //
1111
# FIXME: this is required to build cabal-install 3.2 with ghc 8.6,
1212
# but also for
@@ -23,25 +23,34 @@ in [(
2323
packages.cabal-install.src = pkgs.buildPackages.haskell-nix.sources.cabal-32 + "/cabal-install";
2424
})
2525
];
26-
})]
26+
}
27+
)
28+
29+
# TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
30+
# See https://github.com/haskell/haskell-language-server/issues/2969
31+
# and https://github.com/obsidiansystems/dependent-sum/issues/71
32+
({config, lib, pkgs, ...}:
33+
{ _file = "haskell.nix/overlays/hackage-quirks.nix#haskell-language-server"; } //
34+
lib.mkIf (config.name == "haskell-language-server") {
35+
cabalProject = lib.mkDefault (''
36+
packages: .
37+
constraints: dependent-sum >=0.7.1.0
38+
''
39+
# TODO Remove this flag once the hls-haddock-comments-plugin is updated in hackage to work with ghc 9.2
40+
+ lib.optionalString (__elem config.compiler-nix-name ["ghc921" "ghc922" "ghc923" "ghc924"]) ''
41+
package haskell-language-server
42+
flags: -haddockcomments
43+
'');
44+
}
45+
)
2746

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

35-
# TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
36-
# See https://github.com/haskell/haskell-language-server/issues/2969
37-
# and https://github.com/obsidiansystems/dependent-sum/issues/71
38-
haskell-language-server = {
39-
cabalProject = ''
40-
packages: .
41-
constraints: dependent-sum >=0.7.1.0
42-
'';
43-
};
44-
4554
lsp-test = {
4655
cabalProject = ''
4756
packages: .

Diff for: test/haskell-language-server/cabal.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ in recurseIntoAttrs {
77
};
88
build = project.getComponent "haskell-language-server:exe:haskell-language-server";
99

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

0 commit comments

Comments
 (0)