Skip to content

Commit 1bd9fc1

Browse files
authored
Merge pull request #1146 from horriblename/fix-nixd-options
nix: fix nixd option
2 parents 7e74ee6 + 96e1004 commit 1bd9fc1

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

modules/plugins/languages/nix.nix

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,17 @@
6060
'';
6161
};
6262

63-
nixd = {
63+
nixd = let
64+
settings.nixd = {
65+
inherit (cfg.lsp) options;
66+
formatting.command =
67+
if !cfg.format.enable
68+
then null
69+
else if cfg.format.type == "alejandra"
70+
then ["${cfg.format.package}/bin/alejandra" "--quiet"]
71+
else ["${cfg.format.package}/bin/nixfmt"];
72+
};
73+
in {
6474
package = pkgs.nixd;
6575
internalFormatter = true;
6676
lspConfig = ''
@@ -72,25 +82,7 @@
7282
else noFormat
7383
},
7484
cmd = ${packageToCmd cfg.lsp.package "nixd"},
75-
options = ${toLuaObject cfg.lsp.options},
76-
${optionalString cfg.format.enable ''
77-
settings = {
78-
nixd = {
79-
${optionalString (cfg.format.type == "alejandra")
80-
''
81-
formatting = {
82-
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
83-
},
84-
''}
85-
${optionalString (cfg.format.type == "nixfmt")
86-
''
87-
formatting = {
88-
command = {"${cfg.format.package}/bin/nixfmt"},
89-
},
90-
''}
91-
},
92-
},
93-
''}
85+
settings = ${toLuaObject settings},
9486
}
9587
'';
9688
};

0 commit comments

Comments
 (0)