refactor(nvim): clean up nix code
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
6ca0d7248b
commit
6c5ef370c5
13 changed files with 94 additions and 63 deletions
|
@ -4,7 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe mkIf;
|
||||
inherit (lib) attrValues getExe mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in {
|
||||
|
@ -20,22 +20,31 @@ in {
|
|||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
extraPackages = mkIf cfg.enableIde [
|
||||
pkgs.nodePackages.bash-language-server
|
||||
pkgs.shellcheck
|
||||
];
|
||||
extraPackages = mkIf cfg.enableIde (attrValues {
|
||||
inherit
|
||||
(pkgs.nodePackages)
|
||||
bash-language-server
|
||||
;
|
||||
|
||||
inherit
|
||||
(pkgs)
|
||||
shellcheck
|
||||
;
|
||||
});
|
||||
|
||||
extraLuaConfig =
|
||||
mkIf cfg.enableIde
|
||||
# lua
|
||||
''
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'sh',
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
||||
require('lspconfig').bashls.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
capabilities = default_capabilities,
|
||||
|
||||
settings = {
|
||||
bashIde = {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
inherit (pkgs.writers) writeYAML;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
|
@ -16,7 +16,7 @@ in
|
|||
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = builtins.attrValues {
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
gcc
|
||||
|
@ -29,29 +29,35 @@ in
|
|||
# lua
|
||||
''
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'cpp' , 'c'},
|
||||
pattern = { 'cpp', 'c' },
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
local clangd_extensions = require('clangd_extensions.inlay_hints');
|
||||
|
||||
lsp.cmake.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
capabilities = default_capabilities,
|
||||
});
|
||||
|
||||
lsp.clangd.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
capabilities = default_capabilities,
|
||||
|
||||
handlers = require('lsp-status').extensions.clangd.setup(),
|
||||
|
||||
on_attach = function(_, bufnr)
|
||||
require("clangd_extensions.inlay_hints").setup_autocmd()
|
||||
require("clangd_extensions.inlay_hints").set_inlay_hints()
|
||||
clangd_extensions.setup_autocmd();
|
||||
clangd_extensions.set_inlay_hints();
|
||||
end,
|
||||
});
|
||||
'';
|
||||
|
||||
plugins = builtins.attrValues {
|
||||
inherit (pkgs.vimPlugins) clangd_extensions-nvim;
|
||||
plugins = attrValues {
|
||||
inherit
|
||||
(pkgs.vimPlugins)
|
||||
clangd_extensions-nvim
|
||||
;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in
|
||||
mkIf cfg.enableIde {
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = builtins.attrValues {
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
omnisharp-roslyn
|
||||
|
@ -29,13 +29,13 @@ in
|
|||
local omnisharp_extended = require('omnisharp_extended');
|
||||
|
||||
require('lspconfig').omnisharp.setup({
|
||||
cmd = { "dotnet", "${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll" },
|
||||
cmd = { 'dotnet', '${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll' },
|
||||
|
||||
handlers = {
|
||||
["textDocument/definition"] = omnisharp_extended.definition_handler,
|
||||
["textDocument/typeDefinition"] = omnisharp_extended.type_definition_handler,
|
||||
["textDocument/references"] = omnisharp_extended.references_handler,
|
||||
["textDocument/implementation"] = omnisharp_extended.implementation_handler,
|
||||
['textDocument/definition'] = omnisharp_extended.definition_handler,
|
||||
['textDocument/typeDefinition'] = omnisharp_extended.type_definition_handler,
|
||||
['textDocument/references'] = omnisharp_extended.references_handler,
|
||||
['textDocument/implementation'] = omnisharp_extended.implementation_handler,
|
||||
},
|
||||
|
||||
settings = {
|
||||
|
@ -59,8 +59,11 @@ in
|
|||
});
|
||||
'';
|
||||
|
||||
plugins = builtins.attrValues {
|
||||
inherit (pkgs.vimPlugins) omnisharp-extended-lsp-nvim;
|
||||
plugins = attrValues {
|
||||
inherit
|
||||
(pkgs.vimPlugins)
|
||||
omnisharp-extended-lsp-nvim
|
||||
;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -18,6 +18,7 @@ in {
|
|||
./lua.nix
|
||||
./python.nix
|
||||
./rust.nix
|
||||
|
||||
(import ./markdown.nix self)
|
||||
(import ./nix.nix self)
|
||||
(import ./web.nix self)
|
||||
|
|
|
@ -14,7 +14,7 @@ in
|
|||
# lua
|
||||
''
|
||||
vim.filetype.add({
|
||||
pattern = { ['.*/hypr/.*%.conf'] = 'hyprlang' },
|
||||
pattern = { [ '.*/hypr/.*%.conf' ] = 'hyprlang' },
|
||||
});
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe mkIf;
|
||||
inherit (lib) attrValues getExe mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
|
||||
javaSdk = pkgs.temurin-bin-17;
|
||||
javaPkgs = builtins.attrValues {inherit (pkgs) gradle maven;};
|
||||
javaPkgs = attrValues {inherit (pkgs) gradle maven;};
|
||||
in
|
||||
mkIf cfg.enableIde {
|
||||
home.packages = javaPkgs;
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in
|
||||
mkIf cfg.enableIde {
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = builtins.attrValues {
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
vscode-langservers-extracted
|
||||
|
@ -32,13 +32,14 @@ in
|
|||
});
|
||||
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
lsp.jsonls.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
capabilities = default_capabilities,
|
||||
});
|
||||
|
||||
lsp.yamlls.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
capabilities = default_capabilities,
|
||||
|
||||
settings = {
|
||||
yaml = {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
|
||||
|
@ -13,8 +13,11 @@ in
|
|||
mkIf cfg.enableIde {
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = builtins.attrValues {
|
||||
inherit (pkgs) lua-language-server;
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
lua-language-server
|
||||
;
|
||||
};
|
||||
|
||||
plugins = [
|
||||
|
@ -24,6 +27,8 @@ in
|
|||
config =
|
||||
# lua
|
||||
''
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'lua',
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
|
@ -40,7 +45,7 @@ in
|
|||
});
|
||||
|
||||
require('lspconfig').lua_ls.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
capabilities = default_capabilities,
|
||||
});
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ self: {
|
|||
inherit (self.inputs) vimplugin-easytables-src;
|
||||
inherit (self.lib.${pkgs.system}) buildPlugin;
|
||||
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in {
|
||||
config = mkIf cfg.enableIde {
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = builtins.attrValues {
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
pandoc
|
||||
|
|
|
@ -5,7 +5,8 @@ self: {
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe hasPrefix mkIf removePrefix;
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) attrValues getExe hasPrefix mkIf removePrefix;
|
||||
inherit (osConfig.networking) hostName;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
|
@ -31,15 +32,17 @@ in {
|
|||
}
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
home.packages = attrValues {
|
||||
inherit
|
||||
defaultFormatter
|
||||
nixdPkg
|
||||
];
|
||||
;
|
||||
};
|
||||
|
||||
# nixd by default kinda spams LspLog
|
||||
home.sessionVariables.NIXD_FLAGS = "-log=error";
|
||||
|
||||
xdg.dataFile."${flakeDir}/.nixd.json".text = builtins.toJSON {
|
||||
xdg.dataFile."${flakeDir}/.nixd.json".text = toJSON {
|
||||
nixpkgs = {
|
||||
expr = "import (builtins.getFlake \"${flakeDir}\").inputs.nixpkgs {}";
|
||||
};
|
||||
|
@ -50,9 +53,9 @@ in {
|
|||
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = [
|
||||
nixdPkg
|
||||
];
|
||||
extraPackages = attrValues {
|
||||
inherit nixdPkg;
|
||||
};
|
||||
|
||||
extraLuaConfig =
|
||||
# lua
|
||||
|
|
|
@ -4,31 +4,33 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in
|
||||
mkIf cfg.enableIde {
|
||||
in {
|
||||
config = mkIf cfg.enableIde {
|
||||
programs = {
|
||||
neovim = {
|
||||
withPython3 = true;
|
||||
|
||||
extraPython3Packages = py:
|
||||
with py; ([
|
||||
python-lsp-server
|
||||
]
|
||||
++ python-lsp-server.optional-dependencies.all);
|
||||
(attrValues {
|
||||
inherit (py) python-lsp-server;
|
||||
})
|
||||
++ py.python-lsp-server.optional-dependencies.all;
|
||||
|
||||
extraPackages = with pkgs.python3Packages; ([
|
||||
python-lsp-server
|
||||
]
|
||||
++ python-lsp-server.optional-dependencies.all);
|
||||
extraPackages =
|
||||
(attrValues {
|
||||
inherit (pkgs.python3Packages) python-lsp-server;
|
||||
})
|
||||
++ pkgs.python3Packages.python-lsp-server.optional-dependencies.all;
|
||||
|
||||
extraLuaConfig =
|
||||
# lua
|
||||
''
|
||||
require('lspconfig').pylsp.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
|
@ -42,4 +44,5 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ self: {
|
|||
inherit (self.inputs) vimplugin-ts-error-translator-src;
|
||||
inherit (self.lib.${pkgs.system}) buildPlugin;
|
||||
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib) attrValues mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in {
|
||||
|
@ -16,7 +16,7 @@ in {
|
|||
neovim = {
|
||||
withNodeJs = true;
|
||||
|
||||
extraPackages = builtins.attrValues {
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
neovim-node-client
|
||||
|
@ -114,7 +114,7 @@ in {
|
|||
mode = 'location',
|
||||
},
|
||||
options = {
|
||||
flags = {'unstable_ts_config'},
|
||||
flags = { 'unstable_ts_config' },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue