plugins/lsp: modernize implem of language-servers

This commit is contained in:
Gaetan Lepage 2024-12-14 21:09:46 +01:00 committed by nix-infra-bot
parent 57464f22bb
commit e6018ac195
12 changed files with 618 additions and 598 deletions

View file

@ -4,24 +4,24 @@
pkgs,
...
}:
with lib;
let
cfg = config.plugins.lsp.servers.hls;
inherit (lib) types;
in
{
options.plugins.lsp.servers.hls = {
installGhc = mkOption {
installGhc = lib.mkOption {
type = with types; nullOr bool;
default = null;
example = true;
description = "Whether to install `ghc`.";
};
ghcPackage = mkPackageOption pkgs "ghc" { };
ghcPackage = lib.mkPackageOption pkgs "ghc" { };
};
config = mkIf cfg.enable {
warnings = optional (cfg.installGhc == null) ''
config = lib.mkIf cfg.enable {
warnings = lib.optional (cfg.installGhc == null) ''
`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`.
@ -29,6 +29,6 @@ in
By doing so, you will dismiss this warning.
'';
extraPackages = with pkgs; (optional ((isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage);
extraPackages = lib.optional ((lib.isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage;
};
}