large refactor

This commit is contained in:
Daniel Winkler 2026-05-23 21:59:54 +10:00
commit db610620b3
10 changed files with 286 additions and 143 deletions

View file

@ -70,7 +70,6 @@ in
tokei
wget
yq
zathura
]);
python = maybe "python" (let
@ -90,15 +89,14 @@ in
r = maybe "r" (let
r_packages = (pkgs.baseRPackages or [ ]) ++ config.settings.lang_packages.r;
in
with pkgs; [
(rWrapper.override { packages = r_packages; })
radianWrapper
(quarto.override { extraRPackages = r_packages; })
air-formatter
yaml-language-server
rnvimserver
]);
in [
(pkgs.rpkgs.rWrapper.override { packages = r_packages; })
pkgs.rpkgs.radianWrapper
(pkgs.rpkgs.quarto.override { extraRPackages = r_packages; })
pkgs.air-formatter
pkgs.yaml-language-server
pkgs.rnvimserver
]);
# cats without packages get empty lists
general = [ ];

View file

@ -16,7 +16,7 @@
# Lua packages available to neovim (for :lua require())
config.settings.nvim_lua_env = lp:
lib.optionals (config.cats.general or true) [ lp.tiktoken_core ];
lib.optionals (config.cats.general or false) [ lp.tiktoken_core ];
# Binary name for the wrapper
config.binName = lib.mkDefault "vv";

View file

@ -7,21 +7,21 @@
# Environment variables set for the wrapper.
# These are available when running neovim.
config.env = lib.mkMerge [
(lib.mkIf (config.cats.python or true) {
(lib.mkIf (config.cats.python or false) {
UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = pkgs.python.interpreter;
})
(lib.mkIf (config.cats.r or true) {
(lib.mkIf (config.cats.r or false) {
RNVIM_COMPLDIR = "$PWD/.r-compl";
R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.Rlibs";
R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.r-libs";
TMPDIR = "$PWD/.r-tmp";
})
];
# Environment variables with defaults (can be overridden by user)
config.envDefault = lib.mkMerge [
(lib.mkIf (config.cats.r or true) {
R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.Rlibs";
(lib.mkIf (config.cats.r or false) {
R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.r-libs";
})
];
}

View file

@ -29,7 +29,7 @@
];
};
}
(lib.mkIf (config.cats.julia or true) {
(lib.mkIf (config.cats.julia or false) {
jl = {
nvim-host.enable = true;
nvim-host.package = "${pkgs.julia-bin}/bin/julia";
@ -39,10 +39,10 @@
];
};
})
(lib.mkIf (config.cats.python or true) {
(lib.mkIf (config.cats.python or false) {
python3.nvim-host.enable = true;
})
(lib.mkIf (config.cats.r or true) {
(lib.mkIf (config.cats.r or false) {
r = {
nvim-host.enable = true;
nvim-host.package = "${pkgs.rWrapper}/bin/R";

View file

@ -1,5 +1,6 @@
{
config,
pkgs,
lib,
...
}:
@ -26,14 +27,29 @@
};
default = { };
description = ''
Language-specific package overrides appended to each language spec's runtimePackages.
Intended for flake.nix overrides via wrapper.config.wrap.
Language-specific package defaults and downstream overrides appended to each
language spec's runtime packages.
'';
};
config.settings.lang_packages = {
python = lib.mkDefault [ ];
r = lib.mkDefault [ ];
julia = lib.mkDefault [ ];
python = lib.mkDefault (with pkgs.python3Packages; [
duckdb
polars
]);
r = lib.mkDefault (
(with pkgs.rpkgs.rPackages; [
arrow
broom
data_table
janitor
styler
])
++ [pkgs.nvimcom]
);
julia = lib.mkDefault [
"DataFramesMeta"
"QuackIO"
];
};
}

View file

@ -13,13 +13,13 @@
};
};
config.specs.always = lib.mkIf (config.cats.always or true) {
config.specs.always = lib.mkIf (config.cats.always or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.always;
};
config.specs.external = lib.mkIf (config.cats.external or true) {
config.specs.external = lib.mkIf (config.cats.external or false) {
data = lib.mkDefault null;
before = ["INIT_MAIN"];
config = ''
@ -29,50 +29,50 @@
runtimePkgs = config.catPkgs.external;
};
config.specs.optional = lib.mkIf (config.cats.optional or true) {
config.specs.optional = lib.mkIf (config.cats.optional or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
before = ["INIT_MAIN"];
runtimePkgs = config.catPkgs.optional;
};
config.specs.markdown = lib.mkIf (config.cats.markdown or true) {
config.specs.markdown = lib.mkIf (config.cats.markdown or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.markdown;
};
config.specs.nix = lib.mkIf (config.cats.nix or true) {
config.specs.nix = lib.mkIf (config.cats.nix or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.nix;
};
config.specs.lua = lib.mkIf (config.cats.lua or true) {
config.specs.lua = lib.mkIf (config.cats.lua or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.lua;
};
config.specs.python = lib.mkIf (config.cats.python or true) {
config.specs.python = lib.mkIf (config.cats.python or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.python;
};
config.specs.r = lib.mkIf (config.cats.r or true) {
config.specs.r = lib.mkIf (config.cats.r or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.r;
};
config.specs.julia = lib.mkIf (config.cats.julia or true) {
config.specs.julia = lib.mkIf (config.cats.julia or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.julia;
};
config.specs.clickhouse = lib.mkIf (config.cats.clickhouse or true) {
config.specs.clickhouse = lib.mkIf (config.cats.clickhouse or false) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
runtimePkgs = config.catPkgs.clickhouse;

View file

@ -4,11 +4,11 @@
lib,
...
}: {
config.specs.gitPlugins = lib.mkIf (config.cats.gitPlugins or true) {
config.specs.gitPlugins = lib.mkIf (config.cats.gitPlugins or false) {
data = [];
};
config.specs.r = lib.mkIf (config.cats.r or true) {
config.specs.r = lib.mkIf (config.cats.r or false) {
data = with pkgs.vimPlugins; [
pkgs.r-nvim
quarto-nvim
@ -19,14 +19,14 @@
];
};
config.specs.markdown-lazy = lib.mkIf (config.cats.markdown or true) {
config.specs.markdown-lazy = lib.mkIf (config.cats.markdown or false) {
lazy = true;
data = [
config.nvim-lib.neovimPlugins.cmp-pandoc-references
];
};
config.specs.general = lib.mkIf (config.cats.general or true) {
config.specs.general = lib.mkIf (config.cats.general or false) {
data = with pkgs.vimPlugins; [
lze
lzextras
@ -79,7 +79,7 @@
];
};
config.specs.lua = lib.mkIf (config.cats.lua or true) {
config.specs.lua = lib.mkIf (config.cats.lua or false) {
data = with pkgs.vimPlugins; [
luvit-meta
{
@ -89,7 +89,7 @@
];
};
config.specs.markdown = lib.mkIf (config.cats.markdown or true) {
config.specs.markdown = lib.mkIf (config.cats.markdown or false) {
data = with pkgs.vimPlugins; [
quarto-nvim
render-markdown-nvim
@ -104,7 +104,7 @@
];
};
config.specs.utils = lib.mkIf (config.cats.utils or true) {
config.specs.utils = lib.mkIf (config.cats.utils or false) {
data = with pkgs.vimPlugins; [
blink-cmp
nvim-lspconfig
@ -119,7 +119,7 @@
];
};
config.specs.treesitterParsers = lib.mkIf (config.cats.treesitterParsers or true) {
config.specs.treesitterParsers = lib.mkIf (config.cats.treesitterParsers or false) {
data = with pkgs.vimPlugins.nvim-treesitter-parsers; [
bash
c
@ -158,7 +158,7 @@
];
};
config.specs.utils-lazy = lib.mkIf (config.cats.utils or true) {
config.specs.utils-lazy = lib.mkIf (config.cats.utils or false) {
lazy = true;
data = with pkgs.vimPlugins; [
blink-compat
@ -175,7 +175,7 @@
];
};
config.specs.gitPlugins-lazy = lib.mkIf (config.cats.gitPlugins or true) {
config.specs.gitPlugins-lazy = lib.mkIf (config.cats.gitPlugins or false) {
lazy = true;
data = [];
};