From 38d437dc3e892348d5f6a6c20661b98af93ef545 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Sat, 20 Jun 2026 18:52:12 +0900 Subject: [PATCH] fix: nix fmt --- .../vim/home/plugins/editor/conform.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/applications/vim/home/plugins/editor/conform.nix b/modules/applications/vim/home/plugins/editor/conform.nix index 40013ed..d85945f 100644 --- a/modules/applications/vim/home/plugins/editor/conform.nix +++ b/modules/applications/vim/home/plugins/editor/conform.nix @@ -11,9 +11,22 @@ _: { yaml.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; lua = [ "stylua" ]; - nix = [ "alejandra" ]; + nix.__raw = ''{ "nix_fmt", "alejandra", stop_after_first = true }''; sh = [ "shfmt" ]; }; + formatters.nix_fmt = { + command = "nix"; + args = [ + "fmt" + "$FILENAME" + ]; + stdin = false; + condition.__raw = '' + function() + return vim.fn.executable("nix") == 1 and vim.fn.filereadable(vim.fn.findfile("flake.nix", ".;")) == 1 + end + ''; + }; format_on_save.__raw = '' function(_) return { timeout_ms = 1000, lsp_format = "fallback" }