feat(nvim): add options to trim down package size
All checks were successful
/ check (push) Successful in 25s
/ build (audiomenu) (push) Successful in 2s
/ build (docs) (push) Successful in 2s
/ build (jpassmenu) (push) Successful in 2s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Successful in 2s
/ build (nvim) (push) Successful in 1s
All checks were successful
/ check (push) Successful in 25s
/ build (audiomenu) (push) Successful in 2s
/ build (docs) (push) Successful in 2s
/ build (jpassmenu) (push) Successful in 2s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Successful in 2s
/ build (nvim) (push) Successful in 1s
Seeing as I use `nvim` in the servers, trimming it down a bit would be nice.
This commit is contained in:
parent
1ca0789d4d
commit
dd2bceb7db
4 changed files with 190 additions and 112 deletions
155
nvim/dev-plugins.nix
Normal file
155
nvim/dev-plugins.nix
Normal file
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (helpers) mkRaw enableExceptInTests;
|
||||
cfg = config.jhome.nvim;
|
||||
enabledLSPs = [
|
||||
"bashls"
|
||||
# "clangd" # Adds ~2GiB
|
||||
# "html" # Not writing html
|
||||
"jsonls"
|
||||
"marksman"
|
||||
"nixd"
|
||||
"pyright"
|
||||
"ruff"
|
||||
"taplo"
|
||||
# "texlab" # Not using it
|
||||
"typos_lsp"
|
||||
# "typst_lsp" # Not using it
|
||||
];
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.dev.enable (
|
||||
lib.mkMerge [
|
||||
# Enable LSPs
|
||||
{
|
||||
plugins.lsp.servers = lib.genAttrs enabledLSPs (_: {
|
||||
enable = true;
|
||||
});
|
||||
}
|
||||
# Remove bundled LSPs
|
||||
(lib.mkIf (!cfg.dev.bundleLSPs) {
|
||||
plugins.lsp.servers = lib.genAttrs enabledLSPs (_: {
|
||||
package = null;
|
||||
});
|
||||
})
|
||||
# Configure LSPs
|
||||
{
|
||||
plugins = {
|
||||
lsp.servers.bashls.package = pkgs.bash-language-server;
|
||||
lspkind = {
|
||||
enable = true;
|
||||
mode = "symbol";
|
||||
extraOptions.maxwidth = 50;
|
||||
};
|
||||
lsp-lines.enable = true;
|
||||
};
|
||||
}
|
||||
# Configure Treesitter
|
||||
{
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
settings = {
|
||||
highlight.enable = true;
|
||||
indent.enable = true;
|
||||
incremental_election.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
# Do not bundle treesitter grammars
|
||||
(lib.mkIf (!cfg.dev.bundleGrammars) { plugins.treesitter.grammarPackages = [ ]; })
|
||||
# Configure Formatters
|
||||
{
|
||||
extraPackages = [
|
||||
pkgs.luajitPackages.jsregexp
|
||||
pkgs.shfmt
|
||||
pkgs.stylua
|
||||
pkgs.taplo
|
||||
pkgs.yamlfmt
|
||||
];
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
formatters.nixfmt.command = "${lib.getExe pkgs.nixfmt-rfc-style}";
|
||||
formatters_by_ft = {
|
||||
"_" = [ "trim_whitespace" ];
|
||||
c = [ "clang_format" ];
|
||||
cpp = [ "clang_format" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "nixfmt" ];
|
||||
rust = [ "rustfmt" ];
|
||||
sh = [ "shfmt" ];
|
||||
toml = [ "taplo" ];
|
||||
yaml = [ "yamlfmt" ];
|
||||
zig = [ "zigfmt" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
# Configure Linters
|
||||
{
|
||||
extraPackages = [
|
||||
pkgs.dash
|
||||
pkgs.statix
|
||||
pkgs.zsh
|
||||
];
|
||||
plugins.lint = {
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
# latex = [ "chktex" ]; # Not in use
|
||||
nix = [ "statix" ];
|
||||
sh = [ "dash" ];
|
||||
zsh = [ "zsh" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
# Jupyter notebooks
|
||||
{
|
||||
extraPackages = [ (pkgs.python3.withPackages (p: [ p.jupytext ])) ];
|
||||
plugins = {
|
||||
image.enable = enableExceptInTests;
|
||||
jupytext = {
|
||||
enable = true;
|
||||
settings.custom_language_formatting.python = {
|
||||
extension = "md";
|
||||
style = "markdown";
|
||||
force_ft = "markdown";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
# Rust plugins
|
||||
{
|
||||
plugins = {
|
||||
bacon = {
|
||||
enable = true;
|
||||
settings.quickfix.enabled = true;
|
||||
};
|
||||
rustaceanvim = {
|
||||
enable = true;
|
||||
# Install through rustup
|
||||
rustAnalyzerPackage = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
# Other plugins
|
||||
{
|
||||
plugins = {
|
||||
nvim-colorizer = {
|
||||
enable = true;
|
||||
userDefaultOptions = {
|
||||
names = false; # disable named colors (i.e. red)
|
||||
mode = "virtualtext";
|
||||
};
|
||||
};
|
||||
otter.enable = true;
|
||||
};
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
|
@ -1,7 +1,36 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
options.jhome.nvim.enable = lib.mkEnableOption "jalil's neovim configuration" // {
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
mkDisableOption =
|
||||
desc:
|
||||
mkEnableOption desc
|
||||
// {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.jhome.nvim = {
|
||||
enable = mkDisableOption "jalil's Neovim configuration";
|
||||
dev = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkDisableOption "development configuration";
|
||||
bundleLSPs = mkDisableOption "bundling LSPs with Neovim";
|
||||
bundleGrammars = mkDisableOption "bundling treesitter grammars with Neovim";
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
example = {
|
||||
enable = false;
|
||||
};
|
||||
description = ''
|
||||
Development options
|
||||
|
||||
Disabling this is advised for headless setups (e.g. servers), where you
|
||||
won't be doing software development and would prefer to instead have a
|
||||
smaller package.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
104
nvim/plugins.nix
104
nvim/plugins.nix
|
@ -1,18 +1,9 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
{ lib, helpers, ... }:
|
||||
let
|
||||
inherit (helpers) mkRaw enableExceptInTests;
|
||||
inherit (helpers) mkRaw;
|
||||
in
|
||||
{
|
||||
config.plugins = {
|
||||
bacon = {
|
||||
enable = true;
|
||||
settings.quickfix.enabled = true;
|
||||
};
|
||||
cmp = {
|
||||
enable = true;
|
||||
cmdline = {
|
||||
|
@ -140,77 +131,7 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
# FIXME: doesn't include formatters
|
||||
conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
formatters.nixfmt.command = "${lib.getExe pkgs.nixfmt-rfc-style}";
|
||||
formatters_by_ft = {
|
||||
"_" = [ "trim_whitespace" ];
|
||||
c = [ "clang_format" ];
|
||||
cpp = [ "clang_format" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "nixfmt" ];
|
||||
rust = [ "rustfmt" ];
|
||||
sh = [ "shfmt" ];
|
||||
toml = [ "taplo" ];
|
||||
yaml = [ "yamlfmt" ];
|
||||
zig = [ "zigfmt" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
gitsigns.enable = true;
|
||||
image.enable = enableExceptInTests;
|
||||
jupytext = {
|
||||
enable = true;
|
||||
settings.custom_language_formatting.python = {
|
||||
extension = "md";
|
||||
style = "markdown";
|
||||
force_ft = "markdown";
|
||||
};
|
||||
};
|
||||
lint = {
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
latex = [ "chktex" ];
|
||||
nix = [ "statix" ];
|
||||
sh = [ "dash" ];
|
||||
zsh = [ "zsh" ];
|
||||
};
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
bashls = {
|
||||
enable = true;
|
||||
package = pkgs.bash-language-server;
|
||||
};
|
||||
# clangd.enable = true; # Adds ~2GiB
|
||||
# html.enable = true; # Not writing html
|
||||
jsonls.enable = true;
|
||||
marksman.enable = true;
|
||||
nixd.enable = true;
|
||||
nil_ls = {
|
||||
enable = true;
|
||||
settings.nix.flake = {
|
||||
autoArchive = true;
|
||||
autoEvalInputs = true;
|
||||
};
|
||||
};
|
||||
pyright.enable = true;
|
||||
ruff.enable = true;
|
||||
taplo.enable = true;
|
||||
# texlab.enable = true; # Not writing TeX rn
|
||||
typos_lsp.enable = true;
|
||||
# typst_lsp.enable = true; # Not using it either
|
||||
};
|
||||
};
|
||||
lspkind = {
|
||||
enable = true;
|
||||
mode = "symbol";
|
||||
extraOptions.maxwidth = 50;
|
||||
};
|
||||
lsp-lines.enable = true;
|
||||
lualine = {
|
||||
enable = true;
|
||||
settings.options.theme = lib.mkForce "gruvbox";
|
||||
|
@ -254,19 +175,6 @@ in
|
|||
enable = true;
|
||||
backgroundColour = "#000000";
|
||||
};
|
||||
nvim-colorizer = {
|
||||
enable = true;
|
||||
userDefaultOptions = {
|
||||
names = false; # disable named colors (i.e. red)
|
||||
mode = "virtualtext";
|
||||
};
|
||||
};
|
||||
otter.enable = true;
|
||||
rustaceanvim = {
|
||||
enable = true;
|
||||
# Install through rustup
|
||||
rustAnalyzerPackage = null;
|
||||
};
|
||||
telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
|
@ -274,14 +182,6 @@ in
|
|||
fzy-native.enable = true;
|
||||
};
|
||||
};
|
||||
treesitter = {
|
||||
enable = true;
|
||||
settings = {
|
||||
highlight.enable = true;
|
||||
indent.enable = true;
|
||||
incremental_election.enable = true;
|
||||
};
|
||||
};
|
||||
trouble = {
|
||||
enable = true;
|
||||
settings.auto_close = true;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
imports = [
|
||||
./options.nix
|
||||
./plugins.nix
|
||||
./dev-plugins.nix
|
||||
./mappings.nix
|
||||
./augroups.nix
|
||||
];
|
||||
|
@ -62,14 +63,7 @@
|
|||
# Formatting & linters
|
||||
extraPackages = [
|
||||
pkgs.luajitPackages.jsregexp
|
||||
pkgs.shfmt
|
||||
pkgs.silicon
|
||||
pkgs.statix
|
||||
pkgs.stylua
|
||||
pkgs.taplo
|
||||
pkgs.typos
|
||||
pkgs.yamlfmt
|
||||
(pkgs.python3.withPackages (p: [ p.jupytext ]))
|
||||
];
|
||||
extraConfigLuaPre =
|
||||
# lua
|
||||
|
|
Loading…
Reference in a new issue