Skip to content

Commit 176cc7e

Browse files
committed
languages/nix: add nixd
This adds the [nixd](https://github.com/nix-community/nixd) language server.
1 parent a6d9e75 commit 176cc7e

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

docs/release-notes/rl-0.7.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,7 @@ The changes are, in no particular order:
388388
[DamitusThyYeeticus123](https://github.com/DamitusThyYeetus123):
389389

390390
- Add support for [Astro](https://astro.build/) language server.
391+
392+
[nezia1](https://github.com/nezia1)
393+
394+
- Add support for [nixd](https://github.com/nix-community/nixd) language server.

modules/plugins/languages/nix.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,40 @@
5959
}
6060
'';
6161
};
62+
63+
nixd = {
64+
package = pkgs.nixd;
65+
internalFormatter = true;
66+
lspConfig = ''
67+
lspconfig.nixd.setup{
68+
capabilities = capabilities,
69+
${
70+
if cfg.format.enable
71+
then useFormat
72+
else noFormat
73+
},
74+
cmd = ${packageToCmd cfg.lsp.package "nixd"},
75+
${optionalString cfg.format.enable ''
76+
settings = {
77+
nixd = {
78+
${optionalString (cfg.format.type == "alejandra")
79+
''
80+
formatting = {
81+
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
82+
},
83+
''}
84+
${optionalString (cfg.format.type == "nixfmt")
85+
''
86+
formatting = {
87+
command = {"${cfg.format.package}/bin/nixfmt"},
88+
},
89+
''}
90+
},
91+
},
92+
''}
93+
}
94+
'';
95+
};
6296
};
6397

6498
defaultFormat = "alejandra";

0 commit comments

Comments
 (0)