From 0e5db64202b99113d34d7aab249dbab662f86329 Mon Sep 17 00:00:00 2001 From: Cool-Game-Dev Date: Wed, 13 Aug 2025 14:16:41 -0500 Subject: [PATCH] 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. --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/languages/nix.nix | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index b677ae98..95b37b79 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -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. diff --git a/modules/plugins/languages/nix.nix b/modules/plugins/languages/nix.nix index 6127f78e..ea1c6d00 100644 --- a/modules/plugins/languages/nix.nix +++ b/modules/plugins/languages/nix.nix @@ -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"];