diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 661aee1d..3a09171b 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -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. diff --git a/modules/plugins/languages/nix.nix b/modules/plugins/languages/nix.nix index 4056a415..d6ca6d32 100644 --- a/modules/plugins/languages/nix.nix +++ b/modules/plugins/languages/nix.nix @@ -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";