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; viAlias = true;
vimAlias = true; vimAlias = true;
# We keep the packages here because shell scripts are too common
extraPackages = attrValues { extraPackages = attrValues {
inherit inherit
(pkgs.nodePackages) (pkgs.nodePackages)

View file

@ -4,22 +4,16 @@ self: {
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) attrValues mkIf;
inherit (self.lib.${pkgs.system}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (self.inputs) vimplugin-roslyn-nvim-src; inherit (self.inputs) vimplugin-roslyn-nvim-src;
inherit (lib) mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs = { programs = {
neovim = { neovim = {
extraPackages = attrValues {
inherit
(pkgs)
roslyn-ls
;
};
extraLuaConfig = extraLuaConfig =
# lua # lua
'' ''
@ -27,46 +21,53 @@ in {
pattern = { 'cs' }, pattern = { 'cs' },
command = 'setlocal ts=4 sw=4 sts=0 expandtab', 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 = [ 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, pkgs,
... ...
}: let }: let
inherit (lib) attrValues getExe mkIf; inherit (lib) getExe mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
javaSdk = pkgs.temurin-bin-17; javaSdk = pkgs.temurin-bin-21;
javaPkgs = attrValues {inherit (pkgs) gradle maven;};
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = javaPkgs;
xdg.dataFile.".gradle/gradle.properties".text = ''
org.gradle.java.home = ${javaSdk}
'';
programs = { programs = {
# We keep the packages here because java is a bit complicated
java = { java = {
enable = true; enable = true;
package = javaSdk; package = javaSdk;
}; };
neovim = { neovim = {
extraPackages = javaPkgs;
extraLuaConfig = extraLuaConfig =
# lua # lua
'' ''
@ -44,7 +36,6 @@ in {
config = config =
# lua # lua
'' ''
--
local startJdtls = function() local startJdtls = function()
local config = { local config = {
capabilities = require('cmp_nvim_lsp').default_capabilities(), capabilities = require('cmp_nvim_lsp').default_capabilities(),
@ -60,7 +51,7 @@ in {
configuration = { configuration = {
runtimes = { runtimes = {
{ {
name = 'JavaSE-17', name = 'JavaSE-21',
path = '${javaSdk}', path = '${javaSdk}',
}, },
}, },

View file

@ -1,24 +1,15 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib) attrValues mkIf; inherit (lib) mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs = { programs = {
neovim = { neovim = {
extraPackages = attrValues {
inherit
(pkgs)
vscode-langservers-extracted
yaml-language-server
;
};
extraLuaConfig = extraLuaConfig =
# lua # 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, pkgs,
... ...
}: let }: let
inherit (lib) attrValues mkIf; inherit (lib) mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
@ -13,13 +13,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs = { programs = {
neovim = { neovim = {
extraPackages = attrValues {
inherit
(pkgs)
lua-language-server
;
};
plugins = [ plugins = [
{ {
plugin = pkgs.vimPlugins.neodev-nvim; 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.inputs) vimplugin-easytables-src;
inherit (self.lib.${pkgs.system}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (lib) attrValues concatStringsSep mkIf; inherit (lib) concatStringsSep mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
isServer = osConfig.roles.server.sshd.enable or false; isServer = osConfig.roles.server.sshd.enable or false;
@ -22,16 +22,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs = { programs = {
neovim = { neovim = {
extraPackages = attrValues {
inherit
(pkgs)
pandoc
texlab
texliveFull
rubber
;
};
extraLuaConfig = extraLuaConfig =
# lua # 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 { home.packages = attrValues {
inherit inherit
defaultFormatter defaultFormatter

View file

@ -8,6 +8,7 @@
cfg = config.programs.neovim; cfg = config.programs.neovim;
# We keep the packages here because python is a bit complicated and common
pythonPkgs = py: pythonPkgs = py:
(attrValues { (attrValues {
inherit (py) python-lsp-server; 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.inputs) vimplugin-ts-error-translator-src;
inherit (self.lib.${pkgs.system}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (lib) attrValues mkIf; inherit (lib) mkIf;
cfg = config.programs.neovim; cfg = config.programs.neovim;
in { in {
@ -16,25 +16,6 @@ in {
neovim = { neovim = {
withNodeJs = true; 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 = extraLuaConfig =
# lua # 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
];
}