2024-10-13 15:22:01 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.plugins.lsp.servers.hls;
|
2024-12-14 21:09:46 +01:00
|
|
|
inherit (lib) types;
|
2025-06-08 23:30:08 +01:00
|
|
|
|
|
|
|
ghcPackage = lib.optional (cfg.installGhc == true) cfg.ghcPackage;
|
2024-10-13 15:22:01 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.plugins.lsp.servers.hls = {
|
2024-12-14 21:09:46 +01:00
|
|
|
installGhc = lib.mkOption {
|
2024-10-13 15:22:01 +02:00
|
|
|
type = with types; nullOr bool;
|
|
|
|
default = null;
|
|
|
|
example = true;
|
|
|
|
description = "Whether to install `ghc`.";
|
|
|
|
};
|
|
|
|
|
2024-12-14 21:09:46 +01:00
|
|
|
ghcPackage = lib.mkPackageOption pkgs "ghc" { };
|
2024-10-13 15:22:01 +02:00
|
|
|
};
|
|
|
|
|
2024-12-14 21:09:46 +01:00
|
|
|
config = lib.mkIf cfg.enable {
|
2025-01-29 14:16:00 +01:00
|
|
|
warnings = lib.nixvim.mkWarnings "plugins.lsp.servers.hls" {
|
|
|
|
when = cfg.installGhc == null;
|
|
|
|
message = ''
|
|
|
|
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
|
|
|
- Set `plugins.lsp.servers.hls.installGhc = true` to install it automatically with Nixvim.
|
|
|
|
You can customize which package to install by changing `plugins.lsp.servers.hls.ghcPackage`.
|
|
|
|
- Set `plugins.lsp.servers.hls.installGhc = false` to not have it install through Nixvim.
|
|
|
|
By doing so, you will dismiss this warning.
|
|
|
|
'';
|
|
|
|
};
|
2024-10-13 15:22:01 +02:00
|
|
|
|
2025-06-08 23:30:08 +01:00
|
|
|
extraPackages = lib.optionals (!cfg.packageFallback) ghcPackage;
|
|
|
|
extraPackagesAfter = lib.optionals cfg.packageFallback ghcPackage;
|
2024-10-13 15:22:01 +02:00
|
|
|
};
|
|
|
|
}
|