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

View file

@ -17,6 +17,10 @@
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nvim-lazy = {
url = "git+https://git.ophanim.de/derped/lazy.nvim.nix.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{

View file

@ -36,6 +36,35 @@ with lib;
"latex"
"mail_utils"
"nodejs"
"nvim"
"nvim::cmp"
"nvim::fugitive"
"nvim::go"
"nvim::harpoon"
"nvim::hurl"
"nvim::kanagawa-nvim"
"nvim::lsp"
"nvim::lsp::bash"
"nvim::lsp::emmet"
"nvim::lsp::go"
"nvim::lsp::harper"
"nvim::lsp::ltex"
"nvim::lsp::lua"
"nvim::lsp::nix-nil"
"nvim::lsp::python"
"nvim::lsp::typescript"
"nvim::lsp::yaml"
"nvim::lualine"
"nvim::nvim-highlight"
"nvim::oil-nvim"
"nvim::orgmode"
"nvim::sniprun"
"nvim::telescope"
"nvim::tmux-navigate"
"nvim::treesitter"
"nvim::trim"
"nvim::undotree"
"nvim::which-key"
"python3"
"xpkgs"
];

40
pkgsets/nvim.nix Normal file
View file

@ -0,0 +1,40 @@
{
lib,
config,
fn,
nvim-lazy,
...
}:
with lib;
{
imports =
[
nvim-lazy.nixosModules.nvim-lazy
]
++ (fn.lst {
path = (toString ./nvim);
fullPath = true;
});
programs.nvim-lazy = mkIf (elem "nvim" config.machine.pkgs) {
enable = true;
luaRcContent = # lua
''
vim.g.mapleader = " "
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- TODO: fix option name
-- vim.opt.nformats = alpha
vim.bo.softtabstop = 2
vim.wo.number = true
vim.wo.relativenumber = true
vim.opt.scrolloff = 10
'';
};
}

55
pkgsets/nvim/cmp.nix Normal file
View file

@ -0,0 +1,55 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::cmp" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
# Autocompletion
{
dir = vPlug: vPlug.nvim-cmp;
event = [ "InsertEnter" ];
dependencies = (
vPlug: with vPlug; [
luasnip
]
);
config = # lua
''
function()
${
lib.optionalString (lib.elem "nvim::lsp" config.machine.pkgs) # lua
''
local lsp_zero = require('lsp-zero')
lsp_zero.extend_cmp()
''
}
local cmp = require('cmp')
local cmp_action = lsp_zero.cmp_action()
cmp.setup({
${
lib.optionalString (lib.elem "nvim::lsp" config.machine.pkgs) # lua
''formatting = lsp_zero.cmp_format(),''
}
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
})
})
end
'';
}
{
dir = vPlug: vPlug.luasnip;
lazy = true;
}
];
}

54
pkgsets/nvim/fugitive.nix Normal file
View file

@ -0,0 +1,54 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::fugitive" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
# short = "NeogitOrg/neogit";
lazy = true;
dir = vPlug: vPlug.neogit;
dependencies = (
vPlug: with vPlug; [
# plenary-nvim
"nvim-lua/plenary.nvim"
diffview-nvim
telescope-nvim
]
);
cmd = [ "Neogit" ];
keys = [
{
bind = "<leader>gm";
cmd = "<Cmd>Neogit<CR>";
opts = {
desc = "Open Neogit.";
};
}
];
config = true;
}
{
lazy = true;
dir = vPlug: vPlug.diffview-nvim;
}
{
enabled = true;
lazy = true;
dir = vPlug: vPlug.fugitive;
cmd = [ "Git" ];
keys = [
{
bind = "<leader>gs";
cmd = "<Cmd>Git<CR>";
opts = {
desc = "Open fugitive (git status)";
};
}
# { bind = "<leader>ga"; cmd = "<Cmd>Git<CR>"; opts = { desc = "Open fugitive (git status)"; }; }
];
}
];
}

18
pkgsets/nvim/gen.nix Normal file
View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::gen" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
short = "David-Kunz/gen.nvim";
cmd = [ "Gen" ];
opts = {
model = "deepseek-coder:1.3b-base-q4_0";
};
}
];
}

147
pkgsets/nvim/go.nix Normal file
View file

@ -0,0 +1,147 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::go" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = (vPlug: vPlug.go-nvim);
dependencies = (
vPlug: with vPlug; [
nvim-treesitter.withAllGrammars
nvim-lspconfig
]
);
ft = [
"go"
"gomod"
"ray-x/guihua.lua"
];
config = # lua
''
function()
require('go').setup({
disable_defaults = false, -- true|false when true set false to all boolean settings and replace all table
-- settings with {}
go='go', -- go command, can be go[default] or go1.18beta1
goimports ='gopls', -- goimports command, can be gopls[default] or either goimports or golines if need to split long lines
gofmt = 'gopls', -- gofmt through gopls: alternative is gofumpt, goimports, golines, gofmt, etc
fillstruct = 'gopls', -- set to fillstruct if gopls fails to fill struct
max_line_len = 0, -- max line length in golines format, Target maximum line length for golines
tag_transform = false, -- can be transform option("snakecase", "camelcase", etc) check gomodifytags for details and more options
tag_options = 'json=omitempty', -- sets options sent to gomodifytags, i.e., json=omitempty
gotests_template = "", -- sets gotests -template parameter (check gotests for details)
gotests_template_dir = "", -- sets gotests -template_dir parameter (check gotests for details)
comment_placeholder = "" , -- comment_placeholder your cool placeholder e.g. 󰟓
icons = {breakpoint = '🧘', currentpos = '🏃'}, -- setup to `false` to disable icons setup
verbose = false, -- output loginf in messages
lsp_cfg = true, -- true: use non-default gopls setup specified in go/lsp.lua
-- false: do nothing
-- if lsp_cfg is a table, merge table with with non-default gopls setup in go/lsp.lua, e.g.
-- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}
lsp_gofumpt = true, -- true: set default gofmt in gopls format to gofumpt
-- false: do not set default gofmt in gopls format to gofumpt
lsp_on_attach = nil, -- nil: use on_attach function defined in go/lsp.lua,
-- when lsp_cfg is true
-- if lsp_on_attach is a function: use this function as on_attach function for gopls
lsp_keymaps = false, -- set to false to disable gopls/lsp keymap
lsp_codelens = true, -- set to false to disable codelens, true by default, you can use a function
-- function(bufnr)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {noremap=true, silent=true})
-- end
-- to setup a table of codelens
diagnostic = { -- set diagnostic to false to disable vim.diagnostic setup
hdlr = false, -- hook lsp diag handler and send diag to quickfix
underline = true,
-- virtual text setup
virtual_text = { spacing = 0, prefix = '' },
signs = true,
update_in_insert = false,
},
-- if you need to setup your ui for input and select, you can do it here
-- go_input = require('guihua.input').input -- set to vim.ui.input to disable guihua input
-- go_select = require('guihua.select').select -- vim.ui.select to disable guihua select
lsp_document_formatting = true,
-- set to true: use gopls to format
-- false if you want to use other formatter tool(e.g. efm, nulls)
lsp_inlay_hints = {
enable = true,
-- hint style, set to 'eol' for end-of-line hints, 'inlay' for inline hints
-- inlay only avalible for 0.10.x
style = 'inlay',
-- Note: following setup only works for style = 'eol', you do not need to set it for 'inlay'
-- Only show inlay hints for the current line
only_current_line = false,
-- Event which triggers a refersh of the inlay hints.
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
-- not that this may cause higher CPU usage.
-- This option is only respected when only_current_line and
-- autoSetHints both are true.
only_current_line_autocmd = "CursorHold",
-- whether to show variable name before type hints with the inlay hints or not
-- default: false
show_variable_name = true,
-- prefix for parameter hints
parameter_hints_prefix = "󰊕 ",
show_parameter_hints = true,
-- prefix for all the other hints (type, chaining)
other_hints_prefix = "=> ",
-- whether to align to the lenght of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 6,
-- The color of the hints
highlight = "Comment",
},
gopls_cmd = nil, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" }
gopls_remote_auto = true, -- add -remote=auto to gopls
gocoverage_sign = "",
sign_priority = 5, -- change to a higher number to override other signs
dap_debug = true, -- set to false to disable dap
dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua
-- false: do not use keymap in go/dap.lua. you must define your own.
-- Windows: Use Visual Studio keymap
dap_debug_gui = {}, -- bool|table put your dap-ui setup here set to false to disable
dap_debug_vt = { enabled_commands = true, all_frames = true }, -- bool|table put your dap-virtual-text setup here set to false to disable
dap_port = 38697, -- can be set to a number, if set to -1 go.nvim will pick up a random port
dap_timeout = 15, -- see dap option initialize_timeout_sec = 15,
dap_retries = 20, -- see dap option max_retries
build_tags = "tag1,tag2", -- set default build tags
textobjects = true, -- enable default text objects through treesittter-text-objects
test_runner = 'go', -- one of {`go`, `dlv`, `ginkgo`, `gotestsum`}
verbose_tests = true, -- set to add verbose flag to tests deprecated, see '-v' option
run_in_floaterm = false, -- set to true to run in a float window. :GoTermClose closes the floatterm
-- float term recommend if you use gotestsum ginkgo with terminal color
floaterm = { -- position
posititon = 'auto', -- one of {`top`, `bottom`, `left`, `right`, `center`, `auto`}
width = 0.45, -- width of float window if not auto
height = 0.98, -- height of float window if not auto
title_colors = 'nord', -- default to nord, one of {'nord', 'tokyo', 'dracula', 'rainbow', 'solarized ', 'monokai'}
-- can also set to a list of colors to define colors to choose from
-- e.g {'#D8DEE9', '#5E81AC', '#88C0D0', '#EBCB8B', '#A3BE8C', '#B48EAD'}
},
trouble = false, -- true: use trouble to open quickfix
test_efm = false, -- errorfomat for quickfix, default mix mode, set to true will be efm only
luasnip = false, -- enable included luasnip snippets. you can also disable while add lua/snips folder to luasnip load
-- Do not enable this if you already added the path, that will duplicate the entries
on_jobstart = function(cmd) _=cmd end, -- callback for stdout
on_stdout = function(err, data) _, _ = err, data end, -- callback when job started
on_stderr = function(err, data) _, _ = err, data end, -- callback for stderr
on_exit = function(code, signal, output) _, _, _ = code, signal, output end, -- callback for jobexit, output : string
iferr_vertical_shift = 4 -- defines where the cursor will end up vertically from the begining of if err statement
})
end
'';
}
"ray-x/guihua.lua"
];
}

88
pkgsets/nvim/harpoon.nix Normal file
View file

@ -0,0 +1,88 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::harpoon" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.harpoon2;
lazy = true;
keys =
[
{
bind = "<leader>ha";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():add()
end
'';
}
{
bind = "<leader>he";
cmdIsFunction = true;
cmd = # lua
''
function()
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
end
'';
}
{
bind = "<C-h>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(1)
end
'';
}
{
bind = "<C-j>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(2)
end
'';
}
{
bind = "<C-k>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(3)
end
'';
}
{
bind = "<C-l>";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(4)
end
'';
}
]
++ (map (num: {
bind = "<leader>h${toString (lib.mod num 10)}";
cmdIsFunction = true;
cmd = # lua
''
function()
require("harpoon"):list():select(${toString num})
end
'';
}) (lib.range 1 10));
}
];
}

91
pkgsets/nvim/hurl.nix Normal file
View file

@ -0,0 +1,91 @@
{
lib,
config,
pkgs,
...
}:
lib.mkIf (lib.elem "nvim::hurl" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = vPlug: vPlug.nui-nvim;
}
{
lazy = true;
ft = [ "hurl" ];
short = "jellydn/hurl.nvim";
dependencies = (vPlug: with vPlug; [ nui-nvim ]);
opts = {
debug = false;
show_notification = false;
# Show response in popup or split
mode = "popup";
formatters = {
json = [ "${pkgs.jq}/bin/jq" ];
html = [
"${pkgs.nodePackages.prettier}/bin/prettier"
"--parser"
"html"
];
};
};
keys = [
{
bind = "<leader>A";
cmd = "<cmd>HurlRunner<CR>";
opts = {
ft = "hurl";
desc = "Run All requests";
};
}
{
bind = "<leader>a";
cmd = "<cmd>HurlRunnerAt<CR>";
opts = {
ft = "hurl";
desc = "Run Api request";
};
}
{
bind = "<leader>te";
cmd = "<cmd>HurlRunnerToEntry<CR>";
opts = {
ft = "hurl";
desc = "Run Api request to entry";
};
}
{
bind = "<leader>tm";
cmd = "<cmd>HurlToggleMode<CR>";
opts = {
ft = "hurl";
desc = "Hurl Toggle Mode";
};
}
{
bind = "<leader>tv";
cmd = "<cmd>HurlVerbose<CR>";
opts = {
ft = "hurl";
desc = "Run Api in verbose mode";
};
}
{
bind = "<leader>h";
cmd = ":HurlRunner<CR>";
opts = {
ft = "hurl";
desc = "Hurl Runner";
mode = "v";
};
}
];
}
{
lazy = true;
ft = [ "hurl" ];
dir = vPlug: vPlug.hurl;
}
];
}

View file

@ -0,0 +1,23 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::kanagawa-nvim" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.kanagawa-nvim;
priority = 1000;
config = # lua
''
function()
require('kanagawa').setup({
transparent = true,
})
vim.cmd([[colorscheme kanagawa-wave]])
end
'';
}
];
}

128
pkgsets/nvim/lsp.nix Normal file
View file

@ -0,0 +1,128 @@
{
lib,
config,
pkgs,
fn,
...
}@inputs:
lib.mkIf (lib.elem "nvim::lsp" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins =
let
lspServers = lib.concatStrings (
map (path: import "${path}" (inputs // { inherit pkgs; })) (
fn.lst {
path = ((toString ./.) + "/lsp");
fullPath = true;
}
)
);
in
[
# Yaml schema store for yamlls
{
lazy = true;
dir = vPlug: vPlug.SchemaStore-nvim;
}
{
dir = vPlug: vPlug.lsp-zero-nvim;
lazy = true;
# TODO: This is a bit of a workaround...
config = "false";
init = # lua
''
function()
-- Disable automatic setup, we are doing it manually
vim.g.lsp_zero_extend_cmp = 0
vim.g.lsp_zero_extend_lspconfig = 0
end
'';
}
{
dir = vPlug: vPlug.cmp-nvim-lsp;
lazy = true;
}
{
dir = vPlug: vPlug.nvim-lspconfig;
cmd = [ "LspInfo" ];
event = [
"BufReadPre"
"BufNewFile"
];
dependencies = (
vPlug: with vPlug; [
cmp-nvim-lsp
SchemaStore-nvim
# coq_nvim
]
);
init = # lua
''
function()
---Force a specific language for ltex-ls
---@param lang string
function SetLtexLang(lang)
local clients = vim.lsp.get_clients({ buffer = 0 })
for _, client in ipairs(clients) do
if client.name == "ltex" then
vim.api.nvim_notify("Set ltex-ls lang to " .. lang, vim.log.levels.INFO, { title = "LTex Language", timeout = 2000, })
client.config.settings.ltex.language = lang
vim.lsp.buf_notify(0, "workspace/didChangeConfiguration", { settings = client.config.settings })
return
end
end
end
end
'';
config = # lua
''
function()
-- This is where all the LSP shenanigans will live
local lsp_zero = require('lsp-zero')
lsp_zero.extend_lspconfig()
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
-- (Optional) Configure lua language server for neovim
local lspconfig = require('lspconfig')
${lspServers}
end
'';
opts = {
inlay_hints = {
enabled = true;
};
};
}
# {
# dir = vPlug: vPlug.lspsaga-nvim;
# config = /* lua */ ''
# function()
# require('lspsaga').setup({
# ui = {
# code_action = "󰌵",
# },
# lightbulb = {
# enable = true,
# enable_in_insert = false,
# virtual_text = false,
# },
# })
# end
# '';
# dependencies = [ "nvim-treesitter" "nvim-web-devicons" ];
# }
# {
# lazy = true;
# dir = vPlug: vPlug.nvim-web-devicons;
# }
];
}

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(),
},
},
})
''

72
pkgsets/nvim/lualine.nix Normal file
View file

@ -0,0 +1,72 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::lualine" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.lualine-nvim;
dependencies = [ "nvim-web-devicons" ];
opts = {
options = {
icons_enabled = true;
theme = "auto";
component_separators = {
left = "";
right = "";
};
section_separators = {
left = "";
right = "";
};
disabled_filetypes = {
statusline = { };
winbar = { };
};
ignore_focus = { };
always_divide_middle = true;
globalstatus = false;
refresh = {
statusline = 1000;
tabline = 1000;
winbar = 1000;
};
};
sections = {
lualine_a = [ "mode" ];
lualine_b = [
"branch"
"diff"
"diagnostics"
];
lualine_c = [ "filename" ];
lualine_x = [
"encoding"
"fileformat"
"filetype"
];
lualine_y = [ "progress" ];
lualine_z = [ "location" ];
};
inactive_sections = {
lualine_a = [ ];
lualine_b = [ ];
lualine_c = [ "filename" ];
lualine_x = [ "location" ];
lualine_y = [ ];
lualine_z = [ ];
};
tabline = { };
winbar = { };
inactive_winbar = { };
extensions = { };
};
}
{
lazy = true;
dir = vPlug: vPlug.nvim-web-devicons;
}
];
}

77
pkgsets/nvim/model.nix Normal file
View file

@ -0,0 +1,77 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::model" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
short = "gsuuon/model.nvim";
cmd = [
"M"
"Model"
"Mchat"
];
init = ''
function()
vim.filetype.add({
extension = {
mchat = 'mchat',
}
})
end
'';
ft = [ "mchat" ];
keys = [
{
bind = "<C-m>d";
cmd = ":Mdelete<cr>";
opts = {
mode = "n";
};
}
{
bind = "<C-m>s";
cmd = ":Mselect<cr>";
opts = {
mode = "n";
};
}
{
bind = "<C-m><space>";
cmd = ":Mchat<cr>";
opts = {
mode = "n";
};
}
];
config = ''
function()
require('model.providers.llamacpp').setup({
binary = '/home/derped/.nix-profile/bin/llama-server',
models = '/home/derped/llama/models'
})
require('model').setup({
prompts = {
tower = {
provider = llamacpp,
options = {
model = 's',
args = {
'--keep', -1,
'-c', 8192,
'-ngl', 35
}
}
}
}
})
end
'';
}
];
}

50
pkgsets/nvim/noice.nix Normal file
View file

@ -0,0 +1,50 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::noice" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.noice-nvim;
event = [ "VeryLazy" ];
dependencies =
vPlug: with vPlug; [
nui-nvim
nvim-notify
];
config = # lua
''
function()
require("noice").setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
-- command_palette = true, -- position the cmdline and popupmenu together
-- long_message_to_split = true, -- long messages will be sent to a split
-- inc_rename = false, -- enables an input dialog for inc-rename.nvim
-- lsp_doc_border = false, -- add a border to hover docs and signature help
},
})
end
'';
}
{
lazy = true;
dir = vPlug: vPlug.nvim-notify;
}
{
dir = vPlug: vPlug.dressing-nvim;
opts = { };
}
];
}

View file

@ -0,0 +1,27 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::nvim-highlight" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = vPlug: vPlug.nvim-highlight-colors;
ft = [
"css"
"html"
"js"
"jsx"
"ts"
"tsx"
];
cmd = [ "HighlighColors" ];
opts = {
render = "virtual";
enable_tailwind = true;
};
}
];
}

18
pkgsets/nvim/oil-nvim.nix Normal file
View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::oil-nvim" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = false;
dir = vPlug: vPlug.oil-nvim;
opts = {
default_file_explorer = true;
delete_to_trash = true;
};
}
];
}

40
pkgsets/nvim/orgmode.nix Normal file
View file

@ -0,0 +1,40 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::orgmode" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = vPlug: vPlug.orgmode;
event = [ "VeryLazy" ];
ft = [ "org" ];
dependencies = (
vPlug: with vPlug; [
vim-table-mode
"akinsho/org-bullets.nvim"
]
);
opts = {
org_hide_leading_stars = true;
org_log_done = true;
org_startup_folded = "showeverything";
org_startup_indented = true;
org_adapt_indentation = false;
org_agenda_files = "~/org/**/*";
org_default_notes_file = "~/org/refile.org";
};
}
{
lazy = true;
short = "akinsho/org-bullets.nvim";
opts = { };
}
{
lazy = true;
dir = vPlug: vPlug.vim-table-mode;
}
];
}

16
pkgsets/nvim/otter.nix Normal file
View file

@ -0,0 +1,16 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::otter" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
ft = [ ];
dir = vPlug: vPlug.otter-nvim;
opts = { };
}
];
}

53
pkgsets/nvim/sniprun.nix Normal file
View file

@ -0,0 +1,53 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::sniprun" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = vPlug: vPlug.sniprun;
ft = [
"md"
"adoc"
"org"
"go"
"py"
];
cmd = [ "SnipRun" ];
opts = {
live_mode_toggle = "enable";
# TODO: This does not work, maybe open an issue
# selected_interpreters = [ "Python3_fifo" ];
repl_enable = [ "Python3_original" ];
display = [ "TerminalWithCode" ];
};
keys = [
{
bind = "<leader>sr";
cmd = "<Plug>SnipRun";
opts = {
desc = "Run snippet.";
mode = [
"n"
"v"
];
};
}
{
bind = "<leader>sq";
cmd = "<Plug>SnipClose";
opts = {
desc = "Stop running interpreters.";
mode = [
"n"
"v"
];
};
}
];
}
];
}

View file

@ -0,0 +1,79 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::telescope" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = vPlug: vPlug.telescope-nvim;
dependencies = (
vPlug: with vPlug; [
plenary-nvim
"ghassan0/telescope-glyph.nvim"
"xiyaowong/telescope-emoji.nvim"
]
);
keys = [
{
bind = "<leader>ff";
cmd = "<Cmd>Telescope find_files<CR>";
opts = {
desc = "Telescope Find Files";
};
}
{
bind = "<leader>fg";
cmd = "<Cmd>Telescope git_files<CR>";
opts = {
desc = "Telescope Git Files";
};
}
{
bind = "<leader>fw";
cmd = "<Cmd>Telescope grep_string<CR>";
opts = {
desc = "Telescope Grep Cursor Word";
};
}
{
bind = "<leader>fr";
cmd = "<Cmd>Telescope live_grep<CR>";
opts = {
desc = "Telescope Grep Files";
};
}
{
bind = "<leader>fc";
cmd = "<Cmd>Telescope glyph<CR>";
opts = {
desc = "Telescope find glyphs";
};
}
{
bind = "<leader>fe";
cmd = "<Cmd>Telescope emoji<CR>";
opts = {
desc = "Telescope find emoju";
};
}
];
}
{
lazy = true;
short = "ghassan0/telescope-glyph.nvim";
}
{
lazy = true;
short = "xiyaowong/telescope-emoji.nvim";
}
{
short = "nvim-lua/plenary.nvim";
# 2d9b06177a975543726ce5c73fca176cedbffe9d
# dir = vPlug: vPlug.plenary-nvim;
lazy = true;
}
];
}

View file

@ -0,0 +1,46 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::tmux-navigate" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.vim-tmux-navigator;
cmd = [
"TmuxNavigateLeft"
"TmuxNavigateDown"
"TmuxNavigateUp"
"TmuxNavigateRight"
"TmuxNavigatePrevious"
];
keys = [
{
bind = "<M-h>";
cmd = "<Cmd>TmuxNavigateLeft<CR>";
}
{
bind = "<M-j>";
cmd = "<Cmd>TmuxNavigateDown<CR>";
}
{
bind = "<M-k>";
cmd = "<Cmd>TmuxNavigateUp<CR>";
}
{
bind = "<M-l>";
cmd = "<Cmd>TmuxNavigateRight<CR>";
}
{
bind = "<M-n>";
cmd = "<Cmd>TmuxNavigateNext<CR>";
}
{
bind = "<M-p>";
cmd = "<Cmd>TmuxNavigatePrevious<CR>";
}
];
}
];
}

View file

@ -0,0 +1,69 @@
{
lib,
config,
pkgs,
...
}:
lib.mkIf (lib.elem "nvim::treesitter" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins =
let
org-grammar = pkgs.tree-sitter.buildGrammar {
language = "org";
version = "1.0";
src = pkgs.fetchFromGitHub {
owner = "nvim-orgmode";
repo = "tree-sitter-org";
rev = "436c2dec440e6ad40be98f3b712537bbb08bef0b";
hash = "sha256-k/i+7/K6puXg554BWSLHIDlOXElUovOwOEe5i1Q95L8=";
};
};
# all grammars except replace org-mode
treesitter = pkgs.vimPlugins.nvim-treesitter.withPlugins (
_:
(lib.filter (grammar: grammar.pname != "org-grammar") pkgs.vimPlugins.nvim-treesitter.allGrammars)
++ [ org-grammar ]
);
#treesitter = pkgs.vimPlugins.nvim-treesitter.withAllGrammars;
grammars = pkgs.symlinkJoin {
name = "treesitter-parsers";
paths = treesitter.dependencies;
};
in
[
{
lazy = false;
dir = treesitter;
event = [
"BufReadPost"
"BufWritePost"
"BufNewFile"
"VeryLazy"
];
config = # lua
''
function()
vim.opt.rtp:prepend("${grammars}")
require("nvim-treesitter.configs").setup({
auto_install = false,
highlight = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn", -- set to `false` to disable one of the mappings
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
indent = {
enable = true
}
})
end
'';
}
];
}

16
pkgsets/nvim/trim.nix Normal file
View file

@ -0,0 +1,16 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::trim" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
event = [ "BufWritePre" ];
dir = vPlug: vPlug.trim-nvim;
config = true;
}
];
}

23
pkgsets/nvim/undotree.nix Normal file
View file

@ -0,0 +1,23 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::undotree" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
lazy = true;
dir = vPlug: vPlug.undotree;
keys = [
{
bind = "<leader>u";
cmd = "<Cmd>UndotreeToggle<CR>";
opts = {
desc = "Toggle Undotree";
};
}
];
}
];
}

View file

@ -0,0 +1,36 @@
{
lib,
config,
...
}:
lib.mkIf (lib.elem "nvim::which-key" config.machine.pkgs) {
programs.nvim-lazy.lazyPlugins = [
{
dir = vPlug: vPlug.which-key-nvim;
event = [ "VeryLazy" ];
keys = [
{
bind = "<leader>?";
cmdIsFunction = true;
cmd = # lua
''
function()
require("which-key").show({ global = false })
end
'';
opts = {
desc = "Buffer Local Keymaps (which-key)";
};
}
];
init = # lua
''
function()
vim.o.timeout = off
vim.o.ttimeout = off
end
'';
}
];
}