Skip to content

Commit bc3f8b6

Browse files
authored
Fix haskell-language-server on darwin (#1977)
HLS does not load on darwin because linking on darwin leaves links to GHC and config files used when building. This change works around that issue using the `keepGhc` and `keepConfigFiles` flags. This fix also sets the `ghcide` flag `ghc-patched-unboxed-bytecode` to fix GHC 8.10 support. Fixes 1961
1 parent 7ef2ee4 commit bc3f8b6

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

modules/configuration-nix.nix

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,31 @@ in {
8383

8484
# See https://github.com/input-output-hk/haskell.nix/issues/1455
8585
# This is a work around to make `ghcide` and `haskell-language-server` build with the unboxed tuple patch.
86-
packages.ghcide.patches =
87-
# Work out if we have applied the unboxed tupple patch in overlays/bootstrap.nix
88-
pkgs.lib.optionals (__elem config.compiler.nix-name [
89-
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc8107" "ghc810420210212"
90-
]) [
91-
(fromUntil "1.7.0.0" "1.8.0.0" ../patches/ghcide-1.7-unboxed-tuple-fix-issue-1455.patch)
92-
(fromUntil "1.8.0.0" "2.1.0.0" ../patches/ghcide-1.8-unboxed-tuple-fix-issue-1455.patch)
93-
]
94-
# This is needed for a patch only applied to ghc810420210212
95-
++ pkgs.lib.optional (__elem config.compiler.nix-name [
96-
"ghc810420210212"
97-
]) (from "1.7.0.0" ../patches/ghcide-1.7-plutus-ghc.patch);
86+
packages.ghcide = pkgs.lib.mkIf (__elem config.compiler.nix-name [
87+
# Work out if we have applied the unboxed tupple patch in overlays/bootstrap.nix
88+
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc8107" "ghc810420210212"
89+
]) {
90+
patches =
91+
[
92+
(fromUntil "1.7.0.0" "1.8.0.0" ../patches/ghcide-1.7-unboxed-tuple-fix-issue-1455.patch)
93+
(fromUntil "1.8.0.0" "2.1.0.0" ../patches/ghcide-1.8-unboxed-tuple-fix-issue-1455.patch)
94+
]
95+
# This is needed for a patch only applied to ghc810420210212
96+
++ pkgs.lib.optional (__elem config.compiler.nix-name [
97+
"ghc810420210212"
98+
]) (from "1.7.0.0" ../patches/ghcide-1.7-plutus-ghc.patch);
99+
flags = {
100+
# This flag has enables an additional work around that normally
101+
# is only enabled for ghc >=9.2.
102+
ghc-patched-unboxed-bytecode = true;
103+
};
104+
};
105+
106+
# Fix for https://github.com/input-output-hk/haskell.nix/issues/1961
107+
packages.haskell-language-server.components.exes.haskell-language-server = {
108+
keepGhc = pkgs.stdenv.hostPlatform.isDarwin;
109+
keepConfigFiles = pkgs.stdenv.hostPlatform.isDarwin;
110+
};
98111

99112
packages.language-c.patches = [
100113
# See https://github.com/visq/language-c/pull/89

0 commit comments

Comments
 (0)