languages/nix: add nixd

This adds the [nixd](https://github.com/nix-community/nixd) language
server.
This commit is contained in:
Anthony Rodriguez 2025-02-06 13:08:31 +01:00
parent a6d9e75f37
commit 132c3da8ec
No known key found for this signature in database
2 changed files with 38 additions and 0 deletions

View file

@ -139,3 +139,7 @@
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
Inspiration from `vim.languages.clang.dap` implementation.
[nezia1](https://github.com/nezia1)
- Add support for [nixd](https://github.com/nix-community/nixd) language server.

View file

@ -59,6 +59,40 @@
}
'';
};
nixd = {
package = pkgs.nixd;
internalFormatter = true;
lspConfig = ''
lspconfig.nixd.setup{
capabilities = capabilities,
${
if cfg.format.enable
then useFormat
else noFormat
},
cmd = ${packageToCmd cfg.lsp.package "nixd"},
${optionalString cfg.format.enable ''
settings = {
nixd = {
${optionalString (cfg.format.type == "alejandra")
''
formatting = {
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
},
''}
${optionalString (cfg.format.type == "nixfmt")
''
formatting = {
command = {"${cfg.format.package}/bin/nixfmt"},
},
''}
},
},
''}
}
'';
};
};
defaultFormat = "alejandra";