init wrapper-module config

This commit is contained in:
Daniel Winkler 2026-01-30 14:22:39 +11:00
commit 91755583fd
46 changed files with 4277 additions and 0 deletions

View file

@ -0,0 +1,51 @@
{
config,
lib,
...
}:
{
options.cats = lib.mkOption {
type = lib.types.attrsOf lib.types.bool;
description = ''
Category toggles used to enable/disable specs by name.
Keys map directly to specs (e.g., `python` controls `specs.python`).
Set a category to `false` to skip its dependency/plugin specs.
Available categories:
- clickhouse: Clickhouse client and tools
- customPlugins: local plugin specs
- external: external tools and integrations
- general: core Neovim plugins/features
- gitPlugins: git-related plugins
- julia: Julia tooling and packages
- lua: Lua tooling and LSPs
- markdown: markdown tooling and plugins
- nix: Nix tooling and plugins
- optional: optional tools and utilities
- python: Python tooling and plugins
- r: R tooling and plugins
- test: test-only tooling (disabled by default)
- treesitterParsers: Treesitter parsers
- utils: general utilities
'';
};
config.cats = {
clickhouse = lib.mkDefault false;
customPlugins = lib.mkDefault true;
external = lib.mkDefault true;
general = lib.mkDefault true;
gitPlugins = lib.mkDefault true;
julia = lib.mkDefault false;
lua = lib.mkDefault false;
markdown = lib.mkDefault false;
nix = lib.mkDefault false;
optional = lib.mkDefault false;
python = lib.mkDefault false;
r = lib.mkDefault false;
test = lib.mkDefault false;
treesitterParsers = lib.mkDefault true;
utils = lib.mkDefault true;
};
}

View file

@ -0,0 +1,35 @@
{
config,
lib,
...
}:
{
# Point to the directory containing init.lua, plugin/, lua/, etc.
config.settings.config_directory = ../../..;
# Default colorscheme and background
config.settings.colorscheme = "kanagawa";
config.settings.background = "dark";
# Enable RC wrapping (allows neovim to find the config)
config.settings.wrapRc = true;
# Lua packages available to neovim (for :lua require())
config.settings.nvim_lua_env = lp:
lib.optionals (config.cats.general or false) [ lp.tiktoken_core ];
# Binary name for the wrapper
config.binName = "n";
# Prevent neovim from loading system-wide config
config.settings.block_normal_config = true;
# Don't symlink the config (we wrap it instead)
config.settings.dont_link = false;
# Create additional aliases for the binary
config.settings.aliases = [ "vim" ];
# Enable wrapper handling of spec runtimeDeps (template pattern).
config.settings.autowrapRuntimeDeps = true;
}

View file

@ -0,0 +1,27 @@
{
config,
pkgs,
lib,
...
}:
{
# Environment variables set for the wrapper.
# These are available when running neovim.
config.env = lib.mkMerge [
(lib.mkIf (config.cats.r or false) {
R_LIBS_USER = "./.Rlibs";
})
(lib.mkIf (config.cats.python or false) {
UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = pkgs.python.interpreter;
})
(lib.mkIf (config.cats.test or false) {
TESTVAR = "It worked!";
})
];
# Environment variables with defaults (can be overridden by user)
config.envDefault = lib.mkIf (config.cats.test or false) {
TESTVAR2 = "It worked again!";
};
}

View file

@ -0,0 +1,57 @@
{
config,
pkgs,
lib,
...
}:
{
config.hosts = lib.mkMerge [
{
node.nvim-host.enable = true;
perl.nvim-host.enable = true;
ruby.nvim-host.enable = true;
g = {
nvim-host.enable = true;
nvim-host.package = "${pkgs.neovide}/bin/neovide";
nvim-host.argv0 = "neovide";
nvim-host.flags."--neovim-bin" = "${placeholder "out"}/bin/${config.binName}";
};
m = {
nvim-host.enable = false;
nvim-host.package = "${pkgs.uv}/bin/uv";
nvim-host.argv0 = "uv";
nvim-host.addFlag = [
"run"
"marimo"
"edit"
];
};
}
(lib.mkIf (config.cats.julia or true) {
jl = {
nvim-host.enable = true;
nvim-host.package = "${pkgs.julia-bin}/bin/julia";
nvim-host.argv0 = "julia";
nvim-host.addFlag = [
"--project=@."
];
};
})
(lib.mkIf (config.cats.python or true) {
python3.nvim-host.enable = true;
})
(lib.mkIf (config.cats.r or true) {
r = {
nvim-host.enable = true;
nvim-host.package = "${pkgs.rWrapper}/bin/R";
nvim-host.argv0 = "R";
nvim-host.addFlag = [
"--no-save"
"--no-restore"
];
};
})
];
}

View file

@ -0,0 +1,39 @@
{
config,
lib,
...
}:
{
options.settings.lang_packages = lib.mkOption {
type = lib.types.submodule {
options = {
python = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
description = "Additional Python-related packages appended to the python spec (overlay defaults remain).";
};
r = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
description = "Additional R-related packages appended to the r spec (overlay defaults remain).";
};
julia = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Additional Julia packages (names) passed to julia-bin.withPackages.";
};
};
};
default = { };
description = ''
Language-specific package overrides appended to each language spec's extraPackages.
Intended for flake.nix overrides via wrapper.config.wrap.
'';
};
config.settings.lang_packages = {
python = lib.mkDefault [ ];
r = lib.mkDefault [ ];
julia = lib.mkDefault [ ];
};
}

View file

@ -0,0 +1,35 @@
{
config,
lib,
...
}:
let
collect_runtime_packages = runtime_deps_type:
config.specCollect
(acc: spec:
let
is_enabled = if spec ? enable then spec.enable else true;
has_runtime_deps = (spec.runtimeDeps or false) == runtime_deps_type;
packages = spec.extraPackages or [ ];
in
acc ++ lib.optionals (is_enabled && has_runtime_deps) packages
)
[ ];
prefix_packages = collect_runtime_packages "prefix";
suffix_packages = collect_runtime_packages "suffix";
to_path_specs = packages: [
{
data = [
"PATH"
":"
"${lib.makeBinPath packages}"
];
}
];
in
{
config.prefixVar = lib.optionals (prefix_packages != [ ]) (to_path_specs prefix_packages);
config.suffixVar = lib.optionals (suffix_packages != [ ]) (to_path_specs suffix_packages);
}