mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +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";
|
||||
|
||||
defaultServer = "nil";
|
||||
packageToCmd = package: defaultCmd:
|
||||
if isList package
|
||||
then lib.nvim.lua.expToLua package
|
||||
else ''{"${package}/bin/${defaultCmd}"}'';
|
||||
servers = {
|
||||
rnix = {
|
||||
package = pkgs.rnix-lsp;
|
||||
|
@ -24,7 +28,7 @@ with builtins; let
|
|||
then useFormat
|
||||
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
|
||||
else noFormat
|
||||
},
|
||||
cmd = {"${cfg.lsp.package}/bin/nil"},
|
||||
cmd = ${packageToCmd cfg.lsp.package "nil"},
|
||||
${optionalString cfg.format.enable ''
|
||||
settings = {
|
||||
["nil"] = {
|
||||
|
@ -131,7 +135,7 @@ in {
|
|||
};
|
||||
package = mkOption {
|
||||
description = "Nix LSP server package";
|
||||
type = types.package;
|
||||
type = with types; either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue