refactor(nvim): move packages out of config to devShells
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-22 00:04:13 -05:00
parent 0f627107ce
commit 346077c0e0
16 changed files with 144 additions and 107 deletions

View file

@ -21,6 +21,7 @@ in {
viAlias = true;
vimAlias = true;
# We keep the packages here because shell scripts are too common
extraPackages = attrValues {
inherit
(pkgs.nodePackages)

View file

@ -4,22 +4,16 @@ self: {
pkgs,
...
}: let
inherit (lib) attrValues mkIf;
inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (self.inputs) vimplugin-roslyn-nvim-src;
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
inherit
(pkgs)
roslyn-ls
;
};
extraLuaConfig =
# lua
''
@ -27,46 +21,53 @@ in {
pattern = { 'cs' },
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
});
vim.api.nvim_create_autocmd('User', {
pattern = 'RoslynInitialized',
callback = function()
vim.lsp.inlay_hint.enable();
end,
});
require('roslyn').setup({
config = {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
on_attach = function()
vim.lsp.inlay_hint.enable();
end,
settings = {
["csharp|inlay_hints"] = {
csharp_enable_inlay_hints_for_implicit_object_creation = true,
csharp_enable_inlay_hints_for_implicit_variable_types = true,
csharp_enable_inlay_hints_for_lambda_parameter_types = true,
csharp_enable_inlay_hints_for_types = true,
dotnet_enable_inlay_hints_for_indexer_parameters = true,
dotnet_enable_inlay_hints_for_literal_parameters = true,
dotnet_enable_inlay_hints_for_object_creation_parameters = true,
dotnet_enable_inlay_hints_for_other_parameters = true,
dotnet_enable_inlay_hints_for_parameters = true,
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
},
},
},
exe = 'Microsoft.CodeAnalysis.LanguageServer',
});
'';
plugins = [
(buildPlugin "roslyn-nvim" vimplugin-roslyn-nvim-src)
{
plugin = buildPlugin "roslyn-nvim" vimplugin-roslyn-nvim-src;
type = "lua";
config =
# lua
''
vim.api.nvim_create_autocmd('User', {
pattern = 'RoslynInitialized',
callback = function()
vim.lsp.inlay_hint.enable();
end,
});
require('roslyn').setup({
config = {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
on_attach = function()
vim.lsp.inlay_hint.enable();
end,
settings = {
["csharp|inlay_hints"] = {
csharp_enable_inlay_hints_for_implicit_object_creation = true,
csharp_enable_inlay_hints_for_implicit_variable_types = true,
csharp_enable_inlay_hints_for_lambda_parameter_types = true,
csharp_enable_inlay_hints_for_types = true,
dotnet_enable_inlay_hints_for_indexer_parameters = true,
dotnet_enable_inlay_hints_for_literal_parameters = true,
dotnet_enable_inlay_hints_for_object_creation_parameters = true,
dotnet_enable_inlay_hints_for_other_parameters = true,
dotnet_enable_inlay_hints_for_parameters = true,
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
},
},
},
exe = 'Microsoft.CodeAnalysis.LanguageServer',
});
'';
}
];
};
};

View file

@ -0,0 +1,12 @@
{
mkShell,
dotnetCorePackages,
roslyn-ls,
...
}:
mkShell {
packages = [
dotnetCorePackages.sdk_9_0
roslyn-ls
];
}

View file

@ -4,29 +4,21 @@
pkgs,
...
}: let
inherit (lib) attrValues getExe mkIf;
inherit (lib) getExe mkIf;
cfg = config.programs.neovim;
javaSdk = pkgs.temurin-bin-17;
javaPkgs = attrValues {inherit (pkgs) gradle maven;};
javaSdk = pkgs.temurin-bin-21;
in {
config = mkIf cfg.enable {
home.packages = javaPkgs;
xdg.dataFile.".gradle/gradle.properties".text = ''
org.gradle.java.home = ${javaSdk}
'';
programs = {
# We keep the packages here because java is a bit complicated
java = {
enable = true;
package = javaSdk;
};
neovim = {
extraPackages = javaPkgs;
extraLuaConfig =
# lua
''
@ -44,7 +36,6 @@ in {
config =
# lua
''
--
local startJdtls = function()
local config = {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
@ -60,7 +51,7 @@ in {
configuration = {
runtimes = {
{
name = 'JavaSE-17',
name = 'JavaSE-21',
path = '${javaSdk}',
},
},

View file

@ -1,24 +1,15 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) attrValues mkIf;
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
inherit
(pkgs)
vscode-langservers-extracted
yaml-language-server
;
};
extraLuaConfig =
# lua
''

View file

@ -0,0 +1,12 @@
{
mkShell,
vscode-langservers-extracted,
yaml-language-server,
...
}:
mkShell {
packages = [
vscode-langservers-extracted
yaml-language-server
];
}

View file

@ -4,7 +4,7 @@
pkgs,
...
}: let
inherit (lib) attrValues mkIf;
inherit (lib) mkIf;
cfg = config.programs.neovim;
@ -13,13 +13,6 @@ in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
inherit
(pkgs)
lua-language-server
;
};
plugins = [
{
plugin = pkgs.vimPlugins.neodev-nvim;

View file

@ -0,0 +1,10 @@
{
mkShell,
lua-language-server,
...
}:
mkShell {
packages = [
lua-language-server
];
}

View file

@ -9,7 +9,7 @@ self: {
inherit (self.inputs) vimplugin-easytables-src;
inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (lib) attrValues concatStringsSep mkIf;
inherit (lib) concatStringsSep mkIf;
cfg = config.programs.neovim;
isServer = osConfig.roles.server.sshd.enable or false;
@ -22,16 +22,6 @@ in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
inherit
(pkgs)
pandoc
texlab
texliveFull
rubber
;
};
extraLuaConfig =
# lua
''

View file

@ -0,0 +1,16 @@
{
mkShell,
pandoc,
texlab,
texliveFull,
rubber,
...
}:
mkShell {
packages = [
pandoc
texlab
texliveFull
rubber
];
}

View file

@ -29,6 +29,7 @@ in {
}
];
# We keep the packages here
home.packages = attrValues {
inherit
defaultFormatter

View file

@ -8,6 +8,7 @@
cfg = config.programs.neovim;
# We keep the packages here because python is a bit complicated and common
pythonPkgs = py:
(attrValues {
inherit (py) python-lsp-server;

View file

@ -0,0 +1,16 @@
{
mkShell,
cargo,
rustc,
rust-analyzer,
rustfmt,
...
}:
mkShell {
packages = [
cargo
rustc
rust-analyzer
rustfmt
];
}

View file

@ -7,7 +7,7 @@ self: {
inherit (self.inputs) vimplugin-ts-error-translator-src;
inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (lib) attrValues mkIf;
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
@ -16,25 +16,6 @@ in {
neovim = {
withNodeJs = true;
extraPackages = attrValues {
inherit
(pkgs)
neovim-node-client
nodejs_latest
vscode-langservers-extracted
;
inherit
(pkgs.nodePackages)
npm
;
inherit
(self.packages.${pkgs.system})
some-sass-language-server
;
};
extraLuaConfig =
# lua
''

View file

@ -0,0 +1,21 @@
{
mkShell,
neovim-node-client,
nodejs_latest,
vscode-langservers-extracted,
nodePackages,
self,
system,
...
}:
mkShell {
packages = [
neovim-node-client
nodejs_latest
vscode-langservers-extracted
nodePackages.npm
self.packages.${system}.some-sass-language-server
];
}