Simplified codebase

This commit is contained in:
Daniel Winkler 2026-05-21 18:45:36 +10:00
commit 74600519a5
15 changed files with 83 additions and 280 deletions

View file

@ -14,7 +14,6 @@
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
@ -25,7 +24,6 @@
- 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
'';
@ -33,18 +31,16 @@
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 true;
markdown = lib.mkDefault false;
markdown = lib.mkDefault true;
nix = lib.mkDefault true;
optional = lib.mkDefault false;
python = lib.mkDefault false;
r = lib.mkDefault true;
test = lib.mkDefault false;
treesitterParsers = lib.mkDefault true;
utils = lib.mkDefault true;
};

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 false) [ lp.tiktoken_core ];
lib.optionals (config.cats.general or true) [ lp.tiktoken_core ];
# Binary name for the wrapper
config.binName = lib.mkDefault "vv";
@ -25,10 +25,10 @@
config.settings.block_normal_config = true;
# Don't symlink the config (we wrap it instead)
config.settings.dont_link = false;
config.settings.dont_link = lib.mkDefault false;
# Create additional aliases for the binary
config.settings.aliases = [ "vvim" ];
config.settings.aliases = lib.mkDefault [ "vvim" ];
# Enable wrapper handling of spec runtimeDeps (template pattern).
config.settings.autowrapRuntimeDeps = true;

View file

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

View file

@ -15,7 +15,7 @@
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}";
nvim-host.flags."--neovim-bin" = "${builtins.placeholder "out"}/bin/${config.binName}";
};
m = {

View file

@ -26,7 +26,7 @@
};
default = { };
description = ''
Language-specific package overrides appended to each language spec's extraPackages.
Language-specific package overrides appended to each language spec's runtimePackages.
Intended for flake.nix overrides via wrapper.config.wrap.
'';
};

View file

@ -10,14 +10,13 @@ let
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 [ ];
packages = spec.runtimePackages 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: [
{
@ -31,5 +30,4 @@ let
in
{
config.prefixVar = lib.optionals (prefix_packages != [ ]) (to_path_specs prefix_packages);
config.suffixVar = lib.optionals (suffix_packages != [ ]) (to_path_specs suffix_packages);
}

View file

@ -1,51 +0,0 @@
{ config, lib, ... }:
{
# This module implements category-based enabling of specs.
# It runs early (order 200) so other specMaps can see the enable flags.
#
# How it works:
# 1. For each spec, extract its name (removing -lazy suffix if present)
# 2. Check if there's a corresponding cats.<name> toggle
# 3. Set spec.value.enable based on the cats toggle (default: true)
# 4. This allows specs to be conditionally included based on config.cats settings
#
# Example: If config.cats.python = false, then specs.python.enable = false
config.specMaps = lib.mkOrder 200 [
{
name = "CATS_ENABLE";
data =
list:
map (
v:
if v.type == "spec" || v.type == "parent" then
let
# Extract spec name, handling lazy specs (remove -lazy suffix)
specName =
if v.name == null then
null
else if lib.hasSuffix "-lazy" v.name then
lib.removeSuffix "-lazy" v.name
else
v.name;
# Check if this spec has a corresponding cat toggle
catEnabled =
if specName != null && builtins.hasAttr specName config.cats then
config.cats.${specName}
else
true; # Default to enabled if no cat toggle exists
in
v
// {
value = v.value // {
# Use explicit enable if set, otherwise use cat toggle
enable = if v.value ? enable then v.value.enable else catEnabled;
};
}
else
v
) list;
}
];
}

View file

@ -5,24 +5,14 @@
wlib,
...
}: {
# ============================================================================
# SPEC MODULE DEFAULTS
# ============================================================================
# Define default options available to all specs
config.specMods = {parentSpec ? null, ...}: {
options.extraPackages = lib.mkOption {
options.runtimePkgs = lib.mkOption {
type = lib.types.listOf wlib.types.stringable;
default = [];
description = "a extraPackages spec field to put packages to suffix to the PATH";
description = "a runtimePkgs spec field to put packages to suffix to the PATH";
};
};
# ============================================================================
# EXTERNAL TOOLS SPEC
# ============================================================================
# Core system tools and utilities
config.specs.external = {
data = lib.mkDefault null;
before = ["INIT_MAIN"];
@ -30,7 +20,7 @@
vim.o.shell = "${pkgs.zsh}/bin/zsh"
'';
runtimeDeps = "prefix";
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
perl
ruby
shfmt
@ -39,15 +29,11 @@
];
};
# ============================================================================
# OPTIONAL TOOLS SPEC
# ============================================================================
config.specs.optional = lib.mkIf (config.cats.optional or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
before = ["INIT_MAIN"];
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
bat
broot
devenv
@ -76,54 +62,38 @@
];
};
# ============================================================================
# MARKDOWN SPEC
# ============================================================================
config.specs.markdown = lib.mkIf (config.cats.markdown or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
python313Packages.pylatexenc
quarto
zk
];
};
# ============================================================================
# NIX SPEC
# ============================================================================
config.specs.nix = lib.mkIf (config.cats.nix or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
alejandra
nix-doc
nixd
];
};
# ============================================================================
# LUA SPEC
# ============================================================================
config.specs.lua = lib.mkIf (config.cats.lua or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
lua-language-server
];
};
# ============================================================================
# PYTHON SPEC
# ============================================================================
config.specs.python = lib.mkIf (config.cats.python or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = let
runtimePkgs = let
python_packages_fn =
if pkgs ? basePythonPackages
then ps: pkgs.basePythonPackages ps ++ config.settings.lang_packages.python
@ -139,14 +109,10 @@
];
};
# ============================================================================
# R SPEC
# ============================================================================
config.specs.r = lib.mkIf (config.cats.r or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = let
runtimePkgs = let
r_packages = (pkgs.baseRPackages or []) ++ config.settings.lang_packages.r;
in
with pkgs; [
@ -159,30 +125,22 @@
];
};
# ============================================================================
# JULIA SPEC
# ============================================================================
config.specs.julia = lib.mkIf (config.cats.julia or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = let
runtimePkgs = let
julia_with_packages =
pkgs.julia-bin.withPackages config.settings.lang_packages.julia;
in [julia_with_packages];
};
# ============================================================================
# CLICKHOUSE SPEC
# ============================================================================
config.specs.clickhouse = lib.mkIf (config.cats.clickhouse or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
clickhouse-lts
];
};
config.extraPackages = config.specCollect (acc: v: acc ++ (v.extraPackages or [])) [];
config.runtimePkgs = config.specCollect (acc: v: acc ++ (v.runtimePkgs or [])) [];
}

View file

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