mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 23:16:46 +00:00
feat: make nix lsp install optional
This commit is contained in:
parent
b1184bab47
commit
2f0efdbf15
1 changed files with 7 additions and 3 deletions
|
@ -12,6 +12,10 @@ with builtins; let
|
||||||
noFormat = "on_attach = attach_keymaps";
|
noFormat = "on_attach = attach_keymaps";
|
||||||
|
|
||||||
defaultServer = "nil";
|
defaultServer = "nil";
|
||||||
|
packageToCmd = package: defaultCmd:
|
||||||
|
if isList package
|
||||||
|
then lib.nvim.lua.expToLua package
|
||||||
|
else ''{"${package}/bin/${defaultCmd}"}'';
|
||||||
servers = {
|
servers = {
|
||||||
rnix = {
|
rnix = {
|
||||||
package = pkgs.rnix-lsp;
|
package = pkgs.rnix-lsp;
|
||||||
|
@ -24,7 +28,7 @@ with builtins; let
|
||||||
then useFormat
|
then useFormat
|
||||||
else noFormat
|
else noFormat
|
||||||
},
|
},
|
||||||
cmd = {"${cfg.lsp.package}/bin/rnix-lsp"},
|
cmd = ${packageToCmd cfg.lsp.package "rnix-lsp"},
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -40,7 +44,7 @@ with builtins; let
|
||||||
then useFormat
|
then useFormat
|
||||||
else noFormat
|
else noFormat
|
||||||
},
|
},
|
||||||
cmd = {"${cfg.lsp.package}/bin/nil"},
|
cmd = ${packageToCmd cfg.lsp.package "nil"},
|
||||||
${optionalString cfg.format.enable ''
|
${optionalString cfg.format.enable ''
|
||||||
settings = {
|
settings = {
|
||||||
["nil"] = {
|
["nil"] = {
|
||||||
|
@ -131,7 +135,7 @@ in {
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "Nix LSP server package";
|
description = "Nix LSP server package";
|
||||||
type = types.package;
|
type = with types; either package (listOf str);
|
||||||
default = servers.${cfg.lsp.server}.package;
|
default = servers.${cfg.lsp.server}.package;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue