languages/nix: Add flake formatter

Add a formatter to the nix language module that runs the `nix fmt`
command, which uses a flakes default formatter.
This commit is contained in:
Cool-Game-Dev 2025-08-13 14:16:41 -05:00
commit 0e5db64202
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View file

@ -486,3 +486,5 @@
- Add [roslyn-ls] to the `vim.languages.csharp` module.
- Added json support under `vim.languages.json` using [jsonls] and [jsonfmt].
- Add flake formatter type to the nix language module.

View file

@ -23,6 +23,9 @@
(mkIf (cfg.format.type == "nixfmt") {
command = ["${cfg.format.package}/bin/nixfmt"];
})
(mkIf (cfg.format.type == "flake") {
command = ["${cfg.format.package}/bin/nix" "fmt"];
})
];
};
@ -58,6 +61,10 @@
nixfmt = {
package = pkgs.nixfmt-rfc-style;
};
flake = {
package = pkgs.nix;
};
};
defaultDiagnosticsProvider = ["statix" "deadnix"];