nvim: move to services we do not specify a pkgset
This commit is contained in:
parent
465a6b19d1
commit
11b98d8146
45 changed files with 38 additions and 37 deletions
15
services/nvim/lsp/bash.nix
Normal file
15
services/nvim/lsp/bash.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::bash" config.machine.pkgs) {
|
||||
bashls = {
|
||||
cmd = [
|
||||
"${pkgs.nodePackages.bash-language-server}/bin/bash-language-server"
|
||||
"start"
|
||||
];
|
||||
};
|
||||
}
|
21
services/nvim/lsp/c.nix
Normal file
21
services/nvim/lsp/c.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::c" config.machine.pkgs) {
|
||||
ccls = {
|
||||
cmd = [ "${pkgs.ccls}/bin/ccls" ];
|
||||
init_options = {
|
||||
# compilationDatabaseDirectory = "build";
|
||||
index = {
|
||||
threads = 0;
|
||||
};
|
||||
clang = {
|
||||
excludeArgs = [ "-frounding-math" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
15
services/nvim/lsp/emmet.nix
Normal file
15
services/nvim/lsp/emmet.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::emmet" config.machine.pkgs) {
|
||||
emmet_language_server = {
|
||||
cmd = [
|
||||
"${pkgs.emmet-language-server}/bin/emmet-language-server"
|
||||
"--stdio"
|
||||
];
|
||||
};
|
||||
}
|
12
services/nvim/lsp/go.nix
Normal file
12
services/nvim/lsp/go.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::go" config.machine.pkgs) {
|
||||
gopls = {
|
||||
cmd = [ "${pkgs.gopls}/bin/gopls" ];
|
||||
};
|
||||
}
|
15
services/nvim/lsp/harper.nix
Normal file
15
services/nvim/lsp/harper.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::harper" config.machine.pkgs) {
|
||||
harper_ls = {
|
||||
cmd = [
|
||||
"${pkgs.harper}/bin/harper-ls"
|
||||
"--stdio"
|
||||
];
|
||||
};
|
||||
}
|
15
services/nvim/lsp/html.nix
Normal file
15
services/nvim/lsp/html.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::html" config.machine.pkgs) {
|
||||
# local html_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
# html_capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
html = {
|
||||
capabilities = _: "vim.lsp.protocol.make_client_capabilities()";
|
||||
cmd = [ "${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server" ];
|
||||
};
|
||||
}
|
27
services/nvim/lsp/ltex.nix
Normal file
27
services/nvim/lsp/ltex.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::ltex" config.machine.pkgs) {
|
||||
ltex = {
|
||||
cmd = [ "${pkgs.ltex-ls}/bin/ltex-ls" ];
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "de-DE";
|
||||
};
|
||||
};
|
||||
on_attach =
|
||||
_: # lua
|
||||
''
|
||||
function(client, bufnr)
|
||||
vim.api.nvim_create_user_command(
|
||||
"LtexLang",
|
||||
"lua SetLtexLang(<q-args>)",
|
||||
{ nargs = 1, desc = "Set ltex-ls language" }
|
||||
)
|
||||
end'';
|
||||
};
|
||||
}
|
25
services/nvim/lsp/lua.nix
Normal file
25
services/nvim/lsp/lua.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::lua" config.machine.pkgs) {
|
||||
lua_ls = {
|
||||
cmd = [ "${pkgs.lua-language-server}/bin/lua-language-server" ];
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT";
|
||||
};
|
||||
workspace = {
|
||||
checkThirdParty = false;
|
||||
library = [
|
||||
(_: "vim.env.VIMRUNTIME")
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
15
services/nvim/lsp/markdown.nix
Normal file
15
services/nvim/lsp/markdown.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::markdown" config.machine.pkgs) {
|
||||
marksman = {
|
||||
cmd = [
|
||||
"${pkgs.marksman}/bin/marksman"
|
||||
"server"
|
||||
];
|
||||
};
|
||||
}
|
25
services/nvim/lsp/nix-nil.nix
Normal file
25
services/nvim/lsp/nix-nil.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::nix-nil" config.machine.pkgs) {
|
||||
nil_ls = {
|
||||
cmd = [ "${pkgs.nil}/bin/nil" ];
|
||||
settings = {
|
||||
"['nil']" = {
|
||||
formatting = {
|
||||
command = [ "${pkgs.nixfmt-rfc-style}/bin/nixfmt" ];
|
||||
};
|
||||
maxMemoryMB = 4069;
|
||||
# nix = {
|
||||
# flake = {
|
||||
# autoEvalInputs = true;
|
||||
# };
|
||||
# };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
46
services/nvim/lsp/nix-nixd.nix
Normal file
46
services/nvim/lsp/nix-nixd.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
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
|
||||
|
||||
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'";
|
||||
# };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
21
services/nvim/lsp/php.nix
Normal file
21
services/nvim/lsp/php.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::php" config.machine.pkgs) {
|
||||
phpactor = {
|
||||
cmd = [
|
||||
"${pkgs.phpactor}/bin/phpactor"
|
||||
"language-server"
|
||||
];
|
||||
init_options = {
|
||||
"[\"symfony.enabled\"]" = true;
|
||||
"[\"language_server_phpstan.enabled\"]" = true;
|
||||
"[\"language_server_phpstan.bin\"]" = "${pkgs.phpPackages.phpstan}/bin/phpstan";
|
||||
"[\"language_server_phpstan.level\"]" = 5;
|
||||
};
|
||||
};
|
||||
}
|
54
services/nvim/lsp/python.nix
Normal file
54
services/nvim/lsp/python.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::python" config.machine.pkgs) {
|
||||
pyright = {
|
||||
cmd = [
|
||||
"${pkgs.pyright}/bin/pyright-langserver"
|
||||
"--stdio"
|
||||
];
|
||||
settings = {
|
||||
pyright = {
|
||||
disableOrganizeImports = true;
|
||||
};
|
||||
python = {
|
||||
# analysis = {
|
||||
# ignore = { '*' },
|
||||
# },
|
||||
};
|
||||
};
|
||||
};
|
||||
ruff = {
|
||||
cmd = [
|
||||
"${pkgs.ruff}/bin/ruff"
|
||||
"server"
|
||||
"--preview"
|
||||
];
|
||||
init_options = {
|
||||
settings = {
|
||||
# Modification to any of these settings has no effect.
|
||||
enable = true;
|
||||
ignoreStandardLibrary = true;
|
||||
organizeImports = true;
|
||||
fixAll = true;
|
||||
lineLength = 120;
|
||||
lint = {
|
||||
enable = true;
|
||||
run = "onType";
|
||||
};
|
||||
};
|
||||
};
|
||||
on_attach =
|
||||
_: # lua
|
||||
''
|
||||
function(client, bufnr)
|
||||
if client.name == 'ruff' then
|
||||
client.server_capabilities.hoverProvider = false;
|
||||
end
|
||||
end'';
|
||||
};
|
||||
}
|
17
services/nvim/lsp/rust.nix
Normal file
17
services/nvim/lsp/rust.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::rust" config.machine.pkgs) {
|
||||
rust_analyzer = {
|
||||
cmd = [
|
||||
"${pkgs.rustup}/bin/rustup"
|
||||
"run"
|
||||
"nightly"
|
||||
"rust-analyzer"
|
||||
];
|
||||
};
|
||||
}
|
15
services/nvim/lsp/typescript.nix
Normal file
15
services/nvim/lsp/typescript.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::typescript" config.machine.pkgs) {
|
||||
ts_ls = {
|
||||
cmd = [
|
||||
"${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server"
|
||||
"--stdio"
|
||||
];
|
||||
};
|
||||
}
|
26
services/nvim/lsp/yaml.nix
Normal file
26
services/nvim/lsp/yaml.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.optionalAttrs (lib.elem "nvim::lsp::yaml" config.machine.pkgs) {
|
||||
yamlls = {
|
||||
cmd = [
|
||||
"${pkgs.yaml-language-server}/bin/yaml-language-server"
|
||||
"--stdio"
|
||||
];
|
||||
settings = {
|
||||
yaml = {
|
||||
schemaStore = {
|
||||
# Disable to use Store from SchemaStore-nvim plugin
|
||||
enable = false;
|
||||
# Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
||||
url = "";
|
||||
};
|
||||
schemas = _: "require('schemastore').yaml.schemas()";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue