add neovim full option
This commit is contained in:
parent
26dd42aebb
commit
04f666dabb
1 changed files with 155 additions and 8 deletions
163
flake.nix
163
flake.nix
|
|
@ -188,14 +188,63 @@
|
||||||
(builtins.filter (n: builtins.substring 0 12 n == "nvim_plugin-") (builtins.attrNames inputs));
|
(builtins.filter (n: builtins.substring 0 12 n == "nvim_plugin-") (builtins.attrNames inputs));
|
||||||
});
|
});
|
||||||
|
|
||||||
# All runtime dependencies are now optional and checked lazily by plugins
|
# Minimal runtime dependencies for a lean flake
|
||||||
# This keeps the neovim flake lean and allows project devShells to provide tools
|
|
||||||
runtimeDependencies = with pkgs; [
|
runtimeDependencies = with pkgs; [
|
||||||
ripgrep # search - core to telescope, checked in telescope.lua init
|
ripgrep # search - core to telescope, checked in telescope.lua init
|
||||||
fd # file finding - improves telescope performance, checked in telescope.lua init
|
fd # file finding - improves telescope performance, checked in telescope.lua init
|
||||||
tree-sitter # highlighting
|
tree-sitter # highlighting
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Core tools to prefer in PATH (prefix)
|
||||||
|
runtimeDependenciesCore = with pkgs; [
|
||||||
|
ripgrep
|
||||||
|
fd
|
||||||
|
tree-sitter
|
||||||
|
fzf
|
||||||
|
glow
|
||||||
|
curl
|
||||||
|
sshfs
|
||||||
|
];
|
||||||
|
|
||||||
|
# Full optional tools (suffix) — linters, formatters, LSPs
|
||||||
|
runtimeDependenciesFull = with pkgs; [
|
||||||
|
# linters
|
||||||
|
markdownlint-cli
|
||||||
|
biome
|
||||||
|
# formatters
|
||||||
|
stylua
|
||||||
|
nixfmt-rfc-style
|
||||||
|
nodePackages.prettier
|
||||||
|
rustywind
|
||||||
|
markdownlint-cli2
|
||||||
|
sql-formatter
|
||||||
|
libsForQt5.qt5.qtdeclarative # qmlformat
|
||||||
|
# LSPs
|
||||||
|
nil # nix
|
||||||
|
lua-language-server
|
||||||
|
vscode-langservers-extracted # HTML/CSS/JSON/ESLint
|
||||||
|
nodePackages.typescript-language-server
|
||||||
|
nodePackages.svelte-language-server
|
||||||
|
tailwindcss-language-server
|
||||||
|
python312Packages.python-lsp-server
|
||||||
|
rust-analyzer
|
||||||
|
marksman # markdown
|
||||||
|
taplo # toml
|
||||||
|
yaml-language-server
|
||||||
|
lemminx # xml
|
||||||
|
gopls # go
|
||||||
|
# Other
|
||||||
|
typescript
|
||||||
|
nodejs_24
|
||||||
|
clang
|
||||||
|
(pkgs.rust-bin.stable.latest.default.override {
|
||||||
|
extensions = [
|
||||||
|
"rust-src"
|
||||||
|
"rust-analyzer"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = self.packages.${system}.neovim;
|
default = self.packages.${system}.neovim;
|
||||||
|
|
@ -214,9 +263,7 @@
|
||||||
generatedWrapperArgs =
|
generatedWrapperArgs =
|
||||||
old.generatedWrapperArgs or [ ]
|
old.generatedWrapperArgs or [ ]
|
||||||
++ [
|
++ [
|
||||||
# Add minimal runtime dependencies to neovim path
|
# Add minimal runtime dependencies to neovim path (suffix for devShell precedence)
|
||||||
# Most tools are now optional and checked at runtime
|
|
||||||
# Project devShells take precedence via --suffix
|
|
||||||
"--suffix"
|
"--suffix"
|
||||||
"PATH"
|
"PATH"
|
||||||
":"
|
":"
|
||||||
|
|
@ -297,18 +344,118 @@
|
||||||
"ALL_PROXY"
|
"ALL_PROXY"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
neovimFull =
|
||||||
|
(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
|
||||||
|
pkgs.neovimUtils.makeNeovimConfig {
|
||||||
|
withPython3 = false;
|
||||||
|
customRC = ''
|
||||||
|
lua ${luaNixGlobal}
|
||||||
|
luafile ${./.}/init.lua
|
||||||
|
set runtimepath^=${builtins.concatStringsSep "," (builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins)}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
generatedWrapperArgs =
|
||||||
|
old.generatedWrapperArgs or [ ]
|
||||||
|
++ [
|
||||||
|
# Add core tools, but let local devShell override
|
||||||
|
"--suffix"
|
||||||
|
"PATH"
|
||||||
|
":"
|
||||||
|
"${lib.makeBinPath runtimeDependenciesCore}"
|
||||||
|
]
|
||||||
|
++ [
|
||||||
|
# Add full toolchain, but let local devShell tools override
|
||||||
|
"--suffix"
|
||||||
|
"PATH"
|
||||||
|
":"
|
||||||
|
"${lib.makeBinPath runtimeDependenciesFull}"
|
||||||
|
]
|
||||||
|
++ [
|
||||||
|
# Set the LAZY env path to the nix store, see init.lua for how it is used
|
||||||
|
"--set"
|
||||||
|
"LAZY"
|
||||||
|
"${lazyPath}"
|
||||||
|
]
|
||||||
|
++ [
|
||||||
|
# Don't use default directories to not collide with another neovim config
|
||||||
|
"--run"
|
||||||
|
''export NVIM_FLAKE_BASE_DIR="''${XDG_STATE_HOME:-$HOME/.local/state}"''
|
||||||
|
"--run"
|
||||||
|
''export XDG_CONFIG_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/config"''
|
||||||
|
"--run"
|
||||||
|
''export XDG_DATA_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/share"''
|
||||||
|
"--run"
|
||||||
|
''export XDG_RUNTIME_DIR="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/run"''
|
||||||
|
"--run"
|
||||||
|
''export XDG_STATE_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/state"''
|
||||||
|
"--run"
|
||||||
|
''export XDG_CACHE_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/cache"''
|
||||||
|
"--run"
|
||||||
|
''[ ! -d "$XDG_RUNTIME_DIR" ] && mkdir -p "$XDG_RUNTIME_DIR"''
|
||||||
|
"--run"
|
||||||
|
''
|
||||||
|
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||||
|
if [ ! -S "$XDG_RUNTIME_DIR/wayland-0" ]; then
|
||||||
|
mkdir -p "$XDG_RUNTIME_DIR"
|
||||||
|
ln -sf /run/user/$(id -u)/wayland-0 "$XDG_RUNTIME_DIR/wayland-0"
|
||||||
|
fi
|
||||||
|
if [ ! -S "$XDG_RUNTIME_DIR/wayland-1" ]; then
|
||||||
|
mkdir -p "$XDG_RUNTIME_DIR"
|
||||||
|
ln -sf /run/user/$(id -u)/wayland-1 "$XDG_RUNTIME_DIR/wayland-1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
]
|
||||||
|
++ [
|
||||||
|
# Clear proxy environment variables
|
||||||
|
"--unset"
|
||||||
|
"http_proxy"
|
||||||
|
"--unset"
|
||||||
|
"https_proxy"
|
||||||
|
"--unset"
|
||||||
|
"ftp_proxy"
|
||||||
|
"--unset"
|
||||||
|
"all_proxy"
|
||||||
|
"--unset"
|
||||||
|
"HTTP_PROXY"
|
||||||
|
"--unset"
|
||||||
|
"HTTPS_PROXY"
|
||||||
|
"--unset"
|
||||||
|
"FTP_PROXY"
|
||||||
|
"--unset"
|
||||||
|
"ALL_PROXY"
|
||||||
|
];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
default =
|
default =
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
cfg = config."ringofstorms-nvim";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
environment.systemPackages = [
|
options."ringofstorms-nvim".includeAllRuntimeDependencies =
|
||||||
self.packages.${pkgs.system}.default
|
lib.mkEnableOption "Include all runtime dependencies (LSPs, formatters, linters, tools) in the packaged Neovim PATH.";
|
||||||
];
|
|
||||||
|
config = {
|
||||||
|
environment.systemPackages = [
|
||||||
|
(
|
||||||
|
if cfg.includeAllRuntimeDependencies then
|
||||||
|
self.packages.${pkgs.system}.neovimFull
|
||||||
|
else
|
||||||
|
self.packages.${pkgs.system}.neovim
|
||||||
|
)
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue