pkgsets/nvim: update lsp config to use opts

This commit is contained in:
Kevin Baensch 2025-03-21 23:55:52 +01:00
parent d8f29e12b5
commit 378da9479f
Signed by: derped
GPG key ID: C0F1D326C7626543
17 changed files with 355 additions and 339 deletions

View file

@ -5,38 +5,42 @@
...
}:
lib.optionalString (lib.elem "nvim::lsp::nix-nixd" config.machine.pkgs) # lua
''
lspconfig.nixd.setup({
cmd = { "${pkgs.nixd}/bin/nixd" },
settings = {
nixd = {
-- on_init = function(client)
-- local path = client.workspace_folders[1].name
lib.optionalAttrs (lib.elem "nvim::lsp::nix-nixd" config.machine.pkgs) {
nixd = {
cmd = [ "${pkgs.nixd}/bin/nixd" ];
settings = {
nixd = {
on_init =
_: # lua
''
function(client)
local path = client.workspace_folders[1].name
-- if path == '/path/to/project1' then
-- client.config.settings["rust-analyzer"].checkOnSave.overrideCommand = { "cargo", "check" }
-- client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
-- end
if path == '/path/to/project1' then
client.config.settings["rust-analyzer"].checkOnSave.overrideCommand = { "cargo", "check" }
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
end
-- return true
-- end,
nixpkgs = {
expr = 'import (builtins.getFlake ("git+file:///etc/nixos")).inputs.nixpkgs {}',
},
formatting = {
command = { "${pkgs.nixfmt-rfc-style}/bin/nixfmt" },
},
options = {
nixos = {
expr = '(builtins.getFlake ("git+file:///etc/nixos")).outputs.nixosConfigurations.Lilim.options',
},
-- TODO: Find a good general expression for this.
-- home_manager = {
-- expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."ruixi@k-on".options',
-- },
},
},
},
})
''
return true
end
'';
nixpkgs = {
expr = ''import (builtins.getFlake ("git+file:///etc/nixos")).inputs.nixpkgs {}'';
};
formatting = {
command = [ "${pkgs.nixfmt-rfc-style}/bin/nixfmt" ];
};
options = {
nixos = {
expr = ''(builtins.getFlake ("git+file:///etc/nixos")).outputs.nixosConfigurations.Lilim.options'';
};
# TODO: Find a good general expression for this.
# home_manager = {
# expr =
# "'(builtins.getFlake (\"git+file://\" + toString ./.)).homeConfigurations.\"ruixi@k-on\".options'";
# };
};
};
};
};
}