Add nvim-lazy submodule and add plugin configuration.

This commit is contained in:
Kevin Baensch 2024-12-01 16:54:44 +01:00
parent f545e30831
commit b1ad0b623a
Signed by: derped
GPG key ID: C0F1D326C7626543
39 changed files with 1599 additions and 0 deletions

14
pkgsets/nvim/lsp/bash.nix Normal file
View file

@ -0,0 +1,14 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::bash" config.machine.pkgs) # lua
''
lspconfig.bashls.setup({
cmd = {"${pkgs.nodePackages.bash-language-server}/bin/bash-language-server", "start"},
filetypes = {"sh"},
})
''

View file

@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::emmet" config.machine.pkgs) # lua
''
lspconfig.emmet_language_server.setup({
cmd = {"${pkgs.emmet-language-server}/bin/emmet-language-server", "--stdio"}
})
''

13
pkgsets/nvim/lsp/go.nix Normal file
View file

@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::go" config.machine.pkgs) # lua
''
lspconfig.gopls.setup({
cmd = {"${pkgs.gopls}/bin/gopls"}
})
''

View file

@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::harper" config.machine.pkgs) # lua
''
lspconfig.harper_ls.setup({
cmd = { "${pkgs.harper}/bin/harper-ls", "--stdio" },
})
''

16
pkgsets/nvim/lsp/html.nix Normal file
View file

@ -0,0 +1,16 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::html" config.machine.pkgs) # lua
''
local html_capabilities = vim.lsp.protocol.make_client_capabilities()
html_capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.html.setup({
capabilities = html_capabilities,
cmd = {"${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server"}
})
''

24
pkgsets/nvim/lsp/ltex.nix Normal file
View file

@ -0,0 +1,24 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::ltex" config.machine.pkgs) # lua
''
lspconfig.ltex.setup({
cmd = { "${pkgs.ltex-ls}/bin/ltex-ls" },
settings = {
ltex = {
language = "de-DE",
},
},
})
vim.api.nvim_create_user_command(
"LtexLang",
"lua SetLtexLang(<q-args>)",
{ nargs = 1, desc = "Set ltex-ls language" }
)
''

26
pkgsets/nvim/lsp/lua.nix Normal file
View file

@ -0,0 +1,26 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::lua" config.machine.pkgs) # lua
''
lspconfig.lua_ls.setup({
cmd = {"${pkgs.lua-language-server}/bin/lua-language-server"},
settings = {
Lua = {
runtime = {
version = 'LuaJIT'
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
}
}
}
}
})
''

View file

@ -0,0 +1,26 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::nix-nil" config.machine.pkgs) # lua
''
lspconfig.nil_ls.setup({
cmd = {"${pkgs.nil}/bin/nil"},
settings = {
['nil'] = {
formatting = {
command = { "${pkgs.nixfmt-rfc-style}/bin/nixfmt" }
},
maxMemoryMB = 4069,
-- nix = {
-- flake = {
-- autoEvalInputs = true
-- }
-- }
}
}
})
''

View file

@ -0,0 +1,42 @@
{
lib,
config,
pkgs,
...
}:
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
-- 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',
-- },
},
},
},
})
''

19
pkgsets/nvim/lsp/php.nix Normal file
View file

@ -0,0 +1,19 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::php" config.machine.pkgs) # lua
''
lspconfig.phpactor.setup({
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,
},
})
''

View file

@ -0,0 +1,44 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::python" config.machine.pkgs) # lua
''
lspconfig.pyright.setup({
cmd = {"${pkgs.pyright}/bin/pyright-langserver", "--stdio"},
settings = {
pyright = {
disableOrganizeImports = true,
},
python = {
-- analysis = {
-- ignore = { '*' },
-- },
},
},
})
lspconfig.ruff.setup({
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,
lint = {
enable = true,
run = 'onType',
},
},
},
on_attach = function(client, bufnr)
if client.name == 'ruff' then
client.server_capabilities.hoverProvider = false;
end
end,
})
''

13
pkgsets/nvim/lsp/rust.nix Normal file
View file

@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::rust" config.machine.pkgs) # lua
''
lspconfig.rust_analyzer.setup({
cmd = {"${pkgs.rustup}/bin/rustup", "run", "nightly", "rust-analyzer"}
})
''

View file

@ -0,0 +1,13 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::typescript" config.machine.pkgs) # lua
''
lspconfig.ts_ls.setup({
cmd = {"${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server", "--stdio"}
})
''

24
pkgsets/nvim/lsp/yaml.nix Normal file
View file

@ -0,0 +1,24 @@
{
lib,
config,
pkgs,
...
}:
lib.optionalString (lib.elem "nvim::lsp::yaml" config.machine.pkgs) # lua
''
lspconfig.yamlls.setup({
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(),
},
},
})
''