Merge pull request #1146 from horriblename/fix-nixd-options
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Treewide Checks / Validate flake (push) Has been cancelled
Treewide Checks / Check formatting (push) Has been cancelled
Treewide Checks / Check source tree for typos (push) Has been cancelled
Treewide Checks / Validate documentation builds (push) Has been cancelled
Treewide Checks / Validate hyperlinks in documentation sources (push) Has been cancelled
Treewide Checks / Validate Editorconfig conformance (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled

nix: fix nixd option
This commit is contained in:
raf 2025-09-15 19:51:11 +03:00 committed by GitHub
commit 1bd9fc1164
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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; package = pkgs.nixd;
internalFormatter = true; internalFormatter = true;
lspConfig = '' lspConfig = ''
@ -72,25 +82,7 @@
else noFormat else noFormat
}, },
cmd = ${packageToCmd cfg.lsp.package "nixd"}, cmd = ${packageToCmd cfg.lsp.package "nixd"},
options = ${toLuaObject cfg.lsp.options}, settings = ${toLuaObject settings},
${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"},
},
''}
},
},
''}
} }
''; '';
}; };