feat(neovim): add nix-store.nvim and change old calls

This commit is contained in:
Alexandre Cavalheiro S. Tiago da Silva 2025-02-18 04:32:35 -03:00
parent 34ad9056ca
commit 39e987678c
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
6 changed files with 206 additions and 219 deletions

View file

@ -122,7 +122,7 @@ function M:start()
vim.fn.setenv("DOTNET_ENVIRONMENT", "Development")
local debugger_path = vim.fn.getnixpath "netcoredbg" .. "/bin/netcoredbg"
local debugger_path = vim.fn.get_nix_store "netcoredbg" .. "/bin/netcoredbg"
local dap = require "dap"

View file

@ -6,8 +6,11 @@
---@type LazySpec
return {
"AstroNvim/astrolsp",
---@param opts AstroLSPOpts
---@return AstroLSPOpts
opts = function(_, opts)
---@type AstroLSPOpts
opts = {
local lsp_options = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = true, -- enable or disable auto formatting on start
@ -104,7 +107,7 @@ return {
globalPlugins = {
{
name = "@vue/typescript-plugin",
location = vim.fn.getnixpath "vue-language-server"
location = vim.fn.get_nix_store "vue-language-server"
.. "/lib/node_modules/@vue/language-server",
languages = { "vue" },
configNamespace = "typescript",
@ -198,5 +201,10 @@ return {
-- this would disable semanticTokensProvider for all clients
-- client.server_capabilities.semanticTokensProvider = nil
end,
},
}
opts = vim.tbl_deep_extend("force", opts, lsp_options)
return opts
end,
}

View file

@ -0,0 +1,9 @@
---@type LazySpec
return {
"wizardlink/nix-store.nvim",
priority = 999999,
lazy = false,
opts = {
allow_unfree = true,
},
}

View file

@ -32,7 +32,7 @@ return {
dap.adapters.cppdbg = {
id = "cppdbg",
type = "executable",
command = vim.fn.getnixpath "vscode-extensions.ms-vscode.cpptools"
command = vim.fn.get_nix_store "vscode-extensions.ms-vscode.cpptools"
.. "/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7",
}

View file

@ -7,14 +7,18 @@ return {
dependencies = {
{
"tris203/rzls.nvim",
opts = function(_, opts)
opts = {
capabilities = vim.lsp.protocol.make_client_capabilities(),
path = vim.fn.getnixpath "rzls" .. "/bin/rzls",
},
path = vim.fn.get_nix_store "rzls" .. "/bin/rzls",
}
return opts
end,
},
},
opts = function(_, opts)
local rzlspath = vim.fn.getnixpath "rzls"
local rzlspath = vim.fn.get_nix_store "rzls"
require("roslyn.config").get()
opts = {

View file

@ -1,37 +1,3 @@
--- Define PackageOutput
--- @enum PackageOutput
local PACKAGEOUTPUT = {
out = 0,
lib = 1,
}
--- Get the store path of a package
--- @param packagename NixSearchExceptions | string
--- @param packageoutput PackageOutput?
--- @return string | nil
vim.fn.getnixpath = function(packagename, packageoutput)
---@enum (key) NixSearchExceptions
local exceptions = {}
return vim.split(
vim.api.nvim_cmd(
vim.api.nvim_parse_cmd(
string.format(
"silent !NIXPKGS_ALLOW_UNFREE=1 nix eval --raw --expr 'with import <nixpkgs> { }; (%s).%s' --impure",
exceptions[packagename] or packagename,
(packageoutput == PACKAGEOUTPUT.out or packageoutput == nil) and "outPath"
or string.format("lib.getLib %s", packagename)
),
{}
) --[[@as vim.api.keyset.cmd]],
{
output = true,
}
),
"\n"
)[3]
end
--- Helper function to allow me to run commands grabbed
--- by the current selection.
--- @param isLua boolean