From 96e1004e5542e1154bbd465e073ac9756b65f0f4 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 15 Sep 2025 18:44:30 +0200 Subject: [PATCH] nix: fix nixd option --- modules/plugins/languages/nix.nix | 32 ++++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/modules/plugins/languages/nix.nix b/modules/plugins/languages/nix.nix index 76310459..7d126e15 100644 --- a/modules/plugins/languages/nix.nix +++ b/modules/plugins/languages/nix.nix @@ -60,7 +60,17 @@ ''; }; - nixd = { + nixd = let + settings.nixd = { + inherit (cfg.lsp) options; + formatting.command = + if !cfg.format.enable + then null + else if cfg.format.type == "alejandra" + then ["${cfg.format.package}/bin/alejandra" "--quiet"] + else ["${cfg.format.package}/bin/nixfmt"]; + }; + in { package = pkgs.nixd; internalFormatter = true; lspConfig = '' @@ -72,25 +82,7 @@ else noFormat }, cmd = ${packageToCmd cfg.lsp.package "nixd"}, - options = ${toLuaObject cfg.lsp.options}, - ${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"}, - }, - ''} - }, - }, - ''} + settings = ${toLuaObject settings}, } ''; };