mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-17 07:51:27 +02:00
nvim-lsp: added package options for basic servers
This commit is contained in:
parent
e19114a4d0
commit
acefec6468
2 changed files with 35 additions and 15 deletions
|
@ -5,7 +5,8 @@
|
|||
{ name
|
||||
, description ? "Enable ${name}."
|
||||
, serverName ? name
|
||||
, packages ? [ pkgs.${name} ]
|
||||
, package ? pkgs.${name}
|
||||
, extraPackages ? { }
|
||||
, cmd ? null
|
||||
, ...
|
||||
}:
|
||||
|
@ -14,16 +15,35 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lsp.servers.${name};
|
||||
|
||||
packageOption =
|
||||
if package != null then {
|
||||
package = mkOption {
|
||||
default = package;
|
||||
type = types.nullOr types.package;
|
||||
};
|
||||
} else { };
|
||||
|
||||
extraPackagesOptions = mapAttrs'
|
||||
(name: defaultPackage: {
|
||||
name = "${name}Package";
|
||||
value = mkOption {
|
||||
default = defaultPackage;
|
||||
type = types.package;
|
||||
};
|
||||
})
|
||||
extraPackages;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.lsp.servers.${name} = {
|
||||
enable = mkEnableOption description;
|
||||
};
|
||||
} // packageOption // extraPackagesOptions;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPackages = packages;
|
||||
extraPackages = (optional (package != null) cfg.package) ++
|
||||
(mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
|
||||
|
||||
plugins.lsp.enabledServers = [{
|
||||
name = serverName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue