From 3df06fe85dd16b49275ec8b4b00ac272e5b66673 Mon Sep 17 00:00:00 2001 From: Erik Mertens Date: Mon, 25 Aug 2025 11:19:01 +0200 Subject: [PATCH] - working nixd configuration on webserver TODO: add other systems --- lua/plugins/lspconfig.lua | 53 ++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 3ba6be2..66d4910 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -164,20 +164,49 @@ return { -- LSP Configuration & Plugins -- nvim 0.11 or above vim.lsp.config('vtsls', vtsls_config) vim.lsp.config('vue_ls', vue_ls_config) + -- vim.lsp.config('nixd', { + -- settings = { + -- nixpkgs = { + -- expr = "import { }" + -- }, + -- options = { + -- nixos = { + -- expr = '(builtins.getFlake "/etc/nixos/").nixosConfigurations.pcerik.options', + -- }, + -- home_manager = { + -- expr = '(builtins.getFlake "/etc/nixos").homeConfigurations.erik.options', + -- }, + -- } + -- } + -- }) vim.lsp.config('nixd', { - settings = { - nixpkgs = { - expr = "import { }" + cmd = { "nixd" }, + settings = { + nixd = { + nixpkgs = { + -- For flake. + -- This expression will be interpreted as "nixpkgs" toplevel + -- Nixd provides package, lib completion/information from it. + -- Resource Usage: Entries are lazily evaluated, entire nixpkgs takes 200~300MB for just "names". + -- Package documentation, versions, are evaluated by-need. + expr = "import (builtins.getFlake(toString ./.)).inputs.nixpkgs { }", + }, + formatting = { + command = { "alejandra" }, -- or nixfmt or nixpkgs-fmt + }, + options = { + nixos = { + expr = "let flake = builtins.getFlake(toString ./.); in flake.nixosConfigurations.webserver.options", }, - options = { - nixos = { - expr = '(builtins.getFlake "/etc/nixos/").nixosConfigurations.pcerik.options', - }, - home_manager = { - expr = '(builtins.getFlake "/etc/nixos").homeConfigurations.erik.options', - }, - } - } + -- home_manager = { + -- expr = 'let flake = builtins.getFlake(toString ./.); in flake.homeConfigurations."erik".options', + -- }, + -- darwin = { + -- expr = 'let flake = builtins.getFlake(toString ./.); in flake.darwinConfigurations."MacBook-Air-von-Erik".options', + -- }, + }, + }, + }, }) vim.lsp.config("ltex_plus", {