nix-community.nixvim/plugins/lsp/language-servers/hls.nix
sportshead 6a054de04d
Some checks are pending
Publish every Git push to main to FlakeHub / flakehub-publish (push) Waiting to run
Publish every git push to Flakestry / publish-flake (push) Waiting to run
Documentation / Build unstable (push) Waiting to run
Documentation / Build 24.11 (push) Waiting to run
Documentation / Build 25.05 (push) Waiting to run
Documentation / Combine builds (push) Blocked by required conditions
Documentation / Deploy (push) Blocked by required conditions
plugins/lsp: add packageFallback option
https://github.com/nix-community/nixvim/pull/3445#pullrequestreview-2908615597
2025-06-16 17:19:27 +00:00

40 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.plugins.lsp.servers.hls;
inherit (lib) types;
ghcPackage = lib.optional (cfg.installGhc == true) cfg.ghcPackage;
in
{
options.plugins.lsp.servers.hls = {
installGhc = lib.mkOption {
type = with types; nullOr bool;
default = null;
example = true;
description = "Whether to install `ghc`.";
};
ghcPackage = lib.mkPackageOption pkgs "ghc" { };
};
config = lib.mkIf cfg.enable {
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.
'';
};
extraPackages = lib.optionals (!cfg.packageFallback) ghcPackage;
extraPackagesAfter = lib.optionals cfg.packageFallback ghcPackage;
};
}