This commit is contained in:
sjcobb 2025-06-01 17:20:08 +01:00
commit 4ca117e728
2 changed files with 2 additions and 10 deletions

View file

@ -8,7 +8,6 @@
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.lists) isList;
inherit (lib.types) bool enum package listOf str nullOr; inherit (lib.types) bool enum package listOf str nullOr;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption; inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;

View file

@ -9,19 +9,12 @@
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum package listOf; inherit (lib.types) enum package listOf;
inherit (lib.nvim.types) mkGrammarOption diagnostics; inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.attrsets) mapListToAttrs; inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.nix; cfg = config.vim.languages.nix;
packageToCmd = package: defaultCmd:
if isList package
then expToLua package
else ''{"${package}/bin/${defaultCmd}"}'';
formattingCmd = mkIf (cfg.format.enable && cfg.lsp.enable) { formattingCmd = mkIf (cfg.format.enable && cfg.lsp.enable) {
formatting = mkMerge [ formatting = mkMerge [
(mkIf (cfg.format.type == "alejandra") { (mkIf (cfg.format.type == "alejandra") {
@ -37,7 +30,7 @@
servers = { servers = {
nil_ls = { nil_ls = {
enable = true; enable = true;
cmd = ["${pkgs.nil}/bin/nil"]; cmd = [(getExe pkgs.nil)];
settings = { settings = {
nil = formattingCmd; nil = formattingCmd;
}; };
@ -47,7 +40,7 @@
nixd = { nixd = {
enable = true; enable = true;
cmd = ["${pkgs.nixd}/bin/nixd"]; cmd = [(getExe pkgs.nixd)];
settings = { settings = {
nixd = formattingCmd; nixd = formattingCmd;
}; };