add nixd lsp

This commit is contained in:
2026-07-23 20:53:15 +02:00
parent d382718ab6
commit 88948c0033
2 changed files with 43 additions and 24 deletions
+29 -10
View File
@@ -2,7 +2,6 @@
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"basedpyright",
"html",
"cssls",
"quick_lint_js",
@@ -27,8 +26,7 @@ require("mason-tool-installer").setup({
local nvlsp = require("nvchad.configs.lspconfig")
-- Define servers
local servers = { "html", "cssls", "basedpyright", "quick_lint_js", "qmlls" }
vim.lsp.enable(servers)
local servers = { "html", "cssls", "basedpyright", "quick_lint_js", "qmlls", "nixd" }
-- Use the new Neovim 0.11 LSP config API
for _, server in ipairs(servers) do
@@ -51,7 +49,32 @@ vim.lsp.config("lua_ls", {
},
})
vim.lsp.config("nixd", {
cmd = { "nixd" },
filetypes = { "nix" },
root_markers = { "flake.nix", ".git" },
settings = {
nixd = {
nixpkgs = {
expr = 'import (builtins.getFlake "/home/user/nix-config").inputs.nixpkgs { }',
},
formatting = {
command = { "nixfmt" },
},
options = {
nixos = {
expr = '(builtins.getFlake "/home/user/nix-config").nixosConfigurations.nixos.options',
},
home_manager = {
expr = '(builtins.getFlake "/home/user/nix-config").nixosConfigurations.nixos.options.home-manager.users.type.getSubOptions []',
},
},
},
},
})
vim.lsp.config("basedpyright", {
cmd = { "/run/current-system/sw/bin/basedpyright-langserver", "--stdio" },
settings = {
pyright = {
disableOrganizeImports = true
@@ -64,14 +87,10 @@ vim.lsp.config("basedpyright", {
}
})
vim.lsp.config("pyright", {
on_attach = function(client, bufnr)
end,
capabilities = require("cmp_nvim_lsp").default_capabilities(),
},
vim.filetype.add({
extension = {
log = "log",
},
}))
})
vim.lsp.enable(servers)