update nix channel
This commit is contained in:
parent
a9aac95603
commit
901ef63087
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Update System Channels
|
# Update System Channels
|
||||||
sudo nix-channel --add https://nixos.org/channels/nixpkgs-23.11-darwin nixpkgs
|
sudo nix-channel --add https://nixos.org/channels/nixpkgs-24.05-darwin nixpkgs
|
||||||
sudo nix-channel --update
|
sudo nix-channel --update
|
||||||
|
|
||||||
# Update Home Manager
|
# Update Home Manager
|
||||||
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
|
nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager
|
||||||
nix-channel --update
|
nix-channel --update
|
||||||
|
|
||||||
# Build Home Manager
|
# Build Home Manager
|
||||||
|
@ -3,14 +3,16 @@
|
|||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "go",
|
pattern = "go",
|
||||||
callback = function() vim.bo.textwidth = 120 end
|
callback = function()
|
||||||
|
vim.bo.textwidth = 120
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-------------------- Built-in LSP --------------------
|
-------------------- Built-in LSP --------------------
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
local nix_vars = require("nix-vars")
|
local nix_vars = require("nix-vars")
|
||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require("lspconfig")
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
@ -22,20 +24,20 @@ local on_attach = function(client, bufnr)
|
|||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.buf.format({ async = false, timeout_ms = 2000 })
|
vim.lsp.buf.format({ async = false, timeout_ms = 2000 })
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||||
vim.keymap.set('n', '<leader>lD', vim.lsp.buf.declaration, bufopts)
|
vim.keymap.set("n", "<leader>lD", vim.lsp.buf.declaration, bufopts)
|
||||||
vim.keymap.set('n', '<leader>ld', vim.lsp.buf.definition, bufopts)
|
vim.keymap.set("n", "<leader>ld", vim.lsp.buf.definition, bufopts)
|
||||||
vim.keymap.set('n', '<leader>li', vim.lsp.buf.implementation, bufopts)
|
vim.keymap.set("n", "<leader>li", vim.lsp.buf.implementation, bufopts)
|
||||||
vim.keymap.set('n', '<leader>ln', vim.lsp.buf.rename, bufopts)
|
vim.keymap.set("n", "<leader>ln", vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set('n', '<leader>lr', vim.lsp.buf.references, bufopts)
|
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.references, bufopts)
|
||||||
vim.keymap.set('n', '<leader>lt', vim.lsp.buf.type_definition, bufopts)
|
vim.keymap.set("n", "<leader>lt", vim.lsp.buf.type_definition, bufopts)
|
||||||
vim.keymap.set('n', '<leader>lf', function()
|
vim.keymap.set("n", "<leader>lf", function()
|
||||||
vim.lsp.buf.format {async = true, timeout_ms = 2000}
|
vim.lsp.buf.format({ async = true, timeout_ms = 2000 })
|
||||||
end, bufopts)
|
end, bufopts)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,8 +53,7 @@ local organize_go_imports = function()
|
|||||||
local params = vim.lsp.util.make_range_params(nil, encoding)
|
local params = vim.lsp.util.make_range_params(nil, encoding)
|
||||||
params.context = { only = { "source.organizeImports" } }
|
params.context = { only = { "source.organizeImports" } }
|
||||||
|
|
||||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction",
|
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
|
||||||
params, 3000)
|
|
||||||
for _, res in pairs(result or {}) do
|
for _, res in pairs(result or {}) do
|
||||||
for _, r in pairs(res.result or {}) do
|
for _, r in pairs(res.result or {}) do
|
||||||
if r.edit then
|
if r.edit then
|
||||||
@ -66,91 +67,94 @@ end
|
|||||||
|
|
||||||
-- Define LSP Flags & Capabilities
|
-- Define LSP Flags & Capabilities
|
||||||
local lsp_flags = { debounce_text_changes = 150 }
|
local lsp_flags = { debounce_text_changes = 150 }
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
-- Python LSP Configuration
|
-- Python LSP Configuration
|
||||||
nvim_lsp.pyright.setup {
|
nvim_lsp.pyright.setup({
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
|
|
||||||
-- HTML LSP Configuration
|
-- HTML LSP Configuration
|
||||||
nvim_lsp.html.setup {
|
nvim_lsp.html.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio"}
|
cmd = { nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio" },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- JSON LSP Configuration
|
-- JSON LSP Configuration
|
||||||
nvim_lsp.jsonls.setup {
|
nvim_lsp.jsonls.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio"}
|
cmd = { nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio" },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- CSS LSP Configuration
|
-- CSS LSP Configuration
|
||||||
nvim_lsp.cssls.setup {
|
nvim_lsp.cssls.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio"}
|
cmd = { nix_vars.vscls .. "/bin/vscode-html-language-server", "--stdio" },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Typescript / Javascript LSP Configuration
|
-- Typescript / Javascript LSP Configuration
|
||||||
nvim_lsp.tsserver.setup {
|
nvim_lsp.tsserver.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.tsls, "--stdio"}
|
cmd = { nix_vars.tsls, "--stdio" },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Svelte LSP Configuration
|
-- Svelte LSP Configuration
|
||||||
nvim_lsp.svelte.setup {
|
nvim_lsp.svelte.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.sveltels, "--stdio"}
|
cmd = { nix_vars.sveltels, "--stdio" },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Lua LSP Configuration
|
-- Lua LSP Configuration
|
||||||
nvim_lsp.lua_ls.setup {
|
nvim_lsp.lua_ls.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.luals}
|
cmd = { nix_vars.luals },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Go LSP Configuration
|
-- Go LSP Configuration
|
||||||
nvim_lsp.gopls.setup {
|
nvim_lsp.gopls.setup({
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
on_attach(client, bufnr)
|
on_attach(client, bufnr)
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = organize_go_imports
|
callback = organize_go_imports,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {nix_vars.gopls}
|
cmd = { nix_vars.gopls },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Go LSP Linting
|
-- Go LSP Linting
|
||||||
nvim_lsp.golangci_lint_ls.setup {
|
nvim_lsp.golangci_lint_ls.setup({
|
||||||
on_attach = on_attach_no_formatting,
|
on_attach = on_attach_no_formatting,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = { nix_vars.golintls },
|
cmd = { nix_vars.golintls },
|
||||||
init_options = {
|
init_options = {
|
||||||
command = {
|
command = {
|
||||||
"golangci-lint", "run", "--out-format", "json",
|
"golangci-lint",
|
||||||
"--issues-exit-code=1"
|
"run",
|
||||||
}
|
"--out-format",
|
||||||
}
|
"json",
|
||||||
}
|
"--issues-exit-code=1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
--------------------- Null-LS LSP --------------------
|
--------------------- Null-LS LSP --------------------
|
||||||
@ -158,15 +162,22 @@ nvim_lsp.golangci_lint_ls.setup {
|
|||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
local eslintFiles = {
|
local eslintFiles = {
|
||||||
'.eslintrc', '.eslintrc.js', '.eslintrc.cjs', '.eslintrc.yaml',
|
".eslintrc",
|
||||||
'.eslintrc.yml', '.eslintrc.json', 'eslint.config.js', 'eslint.config.mjs',
|
".eslintrc.js",
|
||||||
'eslint.config.cjs', 'eslint.config.ts', 'eslint.config.mts',
|
".eslintrc.cjs",
|
||||||
'eslint.config.cts'
|
".eslintrc.yaml",
|
||||||
|
".eslintrc.yml",
|
||||||
|
".eslintrc.json",
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
"eslint.config.cjs",
|
||||||
|
"eslint.config.ts",
|
||||||
|
"eslint.config.mts",
|
||||||
|
"eslint.config.cts",
|
||||||
}
|
}
|
||||||
|
|
||||||
has_eslint_in_parents = function(fname)
|
has_eslint_in_parents = function(fname)
|
||||||
root_file = nvim_lsp.util.insert_package_json(eslintFiles, 'eslintConfig',
|
root_file = nvim_lsp.util.insert_package_json(eslintFiles, "eslintConfig", fname)
|
||||||
fname)
|
|
||||||
return nvim_lsp.util.root_pattern(unpack(root_file))(fname)
|
return nvim_lsp.util.root_pattern(unpack(root_file))(fname)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -174,16 +185,17 @@ null_ls.setup({
|
|||||||
sources = {
|
sources = {
|
||||||
-- Prettier Formatting
|
-- Prettier Formatting
|
||||||
null_ls.builtins.formatting.prettier,
|
null_ls.builtins.formatting.prettier,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
require("none-ls.diagnostics.eslint_d").with({
|
||||||
condition = function(utils)
|
condition = function(utils)
|
||||||
return has_eslint_in_parents(vim.fn.getcwd())
|
return has_eslint_in_parents(vim.fn.getcwd())
|
||||||
end
|
end,
|
||||||
}), null_ls.builtins.formatting.djlint.with({filetypes = {"template"}}),
|
}),
|
||||||
|
null_ls.builtins.formatting.djlint.with({ filetypes = { "template" } }),
|
||||||
null_ls.builtins.completion.spell,
|
null_ls.builtins.completion.spell,
|
||||||
null_ls.builtins.formatting.nixpkgs_fmt,
|
null_ls.builtins.formatting.nixpkgs_fmt,
|
||||||
null_ls.builtins.formatting.lua_format,
|
null_ls.builtins.formatting.stylua,
|
||||||
null_ls.builtins.diagnostics.sqlfluff,
|
null_ls.builtins.diagnostics.sqlfluff,
|
||||||
null_ls.builtins.formatting.sqlfluff
|
null_ls.builtins.formatting.sqlfluff,
|
||||||
},
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method("textDocument/formatting") then
|
||||||
@ -193,8 +205,8 @@ null_ls.setup({
|
|||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.buf.format({ async = false, timeout_ms = 2000 })
|
vim.lsp.buf.format({ async = false, timeout_ms = 2000 })
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
@ -25,9 +25,9 @@ in
|
|||||||
nvim-cmp # Completions
|
nvim-cmp # Completions
|
||||||
nvim-lspconfig # LSP Config
|
nvim-lspconfig # LSP Config
|
||||||
|
|
||||||
# ------------------
|
# -------------------
|
||||||
# ----- Helpers ----
|
# ----- Helpers -----
|
||||||
# ------------------
|
# -------------------
|
||||||
aerial-nvim # Code Outline
|
aerial-nvim # Code Outline
|
||||||
comment-nvim # Code Comments
|
comment-nvim # Code Comments
|
||||||
diffview-nvim # Diff View
|
diffview-nvim # Diff View
|
||||||
@ -61,16 +61,33 @@ in
|
|||||||
nvim-treesitter-context
|
nvim-treesitter-context
|
||||||
nvim-treesitter.withAllGrammars
|
nvim-treesitter.withAllGrammars
|
||||||
|
|
||||||
# ------------------
|
# -------------------
|
||||||
# ------ DAP -------
|
# ------- DAP -------
|
||||||
# ------------------
|
# -------------------
|
||||||
nvim-dap
|
nvim-dap
|
||||||
nvim-dap-go
|
nvim-dap-go
|
||||||
nvim-dap-ui
|
nvim-dap-ui
|
||||||
|
|
||||||
# ------------------
|
# --------------------
|
||||||
# ----- Silicon ----
|
# -- NONE-LS EXTRAS --
|
||||||
# ------------------
|
# --------------------
|
||||||
|
(
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
pname = "none-ls-extras.nvim";
|
||||||
|
version = "2024-06-11";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "nvimtools";
|
||||||
|
repo = "none-ls-extras.nvim";
|
||||||
|
rev = "336e84b9e43c0effb735b08798ffac382920053b";
|
||||||
|
sha256 = "sha256-UtU4oWSRTKdEoMz3w8Pk95sROuo3LEwxSDAm169wxwk=";
|
||||||
|
};
|
||||||
|
meta.homepage = "https://github.com/nvimtools/none-ls-extras.nvim/";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# -------------------
|
||||||
|
# ----- Silicon -----
|
||||||
|
# -------------------
|
||||||
(
|
(
|
||||||
pkgs.vimUtils.buildVimPlugin {
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
pname = "silicon.lua";
|
pname = "silicon.lua";
|
||||||
@ -85,6 +102,9 @@ in
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# -------------------
|
||||||
|
# ------- LLM -------
|
||||||
|
# -------------------
|
||||||
(
|
(
|
||||||
pkgs.vimUtils.buildVimPlugin {
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
pname = "llm.nvim";
|
pname = "llm.nvim";
|
||||||
@ -127,6 +147,7 @@ in
|
|||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
nodePackages.prettier
|
nodePackages.prettier
|
||||||
sqlfluff
|
sqlfluff
|
||||||
|
stylua
|
||||||
|
|
||||||
# Silicon
|
# Silicon
|
||||||
silicon
|
silicon
|
||||||
|
Loading…
Reference in New Issue
Block a user