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, ... }:
{
# 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

@ -0,0 +1,188 @@
{
config,
pkgs,
lib,
wlib,
...
}: {
# ============================================================================
# SPEC MODULE DEFAULTS
# ============================================================================
# Define default options available to all specs
config.specMods = {parentSpec ? null, ...}: {
options.extraPackages = lib.mkOption {
type = lib.types.listOf wlib.types.stringable;
default = [];
description = "a extraPackages 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"];
config = ''
vim.o.shell = "${pkgs.zsh}/bin/zsh"
'';
runtimeDeps = "prefix";
extraPackages = with pkgs; [
perl
ruby
shfmt
sqlfluff
tree-sitter
];
};
# ============================================================================
# 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; [
bat
broot
devenv
dust
fd
fzf
gawk
gh
git
hunspell
hunspellDicts.de-at
hunspellDicts.en-us
ispell
jq
just
lazygit
man
ncdu
pigz
poppler
ripgrep
tokei
wget
yq
zathura
];
};
# ============================================================================
# MARKDOWN SPEC
# ============================================================================
config.specs.markdown = lib.mkIf (config.cats.markdown or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = 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; [
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; [
lua-language-server
];
};
# ============================================================================
# PYTHON SPEC
# ============================================================================
config.specs.python = lib.mkIf (config.cats.python or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = let
python_packages_fn =
if pkgs ? basePythonPackages
then ps: pkgs.basePythonPackages ps ++ config.settings.lang_packages.python
else _: config.settings.lang_packages.python;
python_with_packages = pkgs.python3.withPackages python_packages_fn;
in
with pkgs; [
python_with_packages
nodejs
ruff
basedpyright
uv
];
};
# ============================================================================
# R SPEC
# ============================================================================
config.specs.r = lib.mkIf (config.cats.r or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = 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
updateR
];
};
# ============================================================================
# JULIA SPEC
# ============================================================================
config.specs.julia = lib.mkIf (config.cats.julia or true) {
data = lib.mkDefault null;
runtimeDeps = "prefix";
extraPackages = 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; [
clickhouse-lts
];
};
config.extraPackages = config.specCollect (acc: v: acc ++ (v.extraPackages or [])) [];
}

View file

@ -0,0 +1,183 @@
{
config,
pkgs,
lib,
...
}:
{
config.specs.gitPlugins = {
data = [ ];
};
config.specs.r = {
data = [
config.nvim-lib.neovimPlugins.r
];
};
config.specs.markdown-lazy = {
lazy = true;
data = [
config.nvim-lib.neovimPlugins.cmp-pandoc-references
];
};
config.specs.r-lazy = {
lazy = true;
data = [
config.nvim-lib.neovimPlugins.cmp-r
];
};
config.specs.general = {
data = with pkgs.vimPlugins; [
lze
lzextras
plenary-nvim
neogit
{
data = mini-nvim;
pname = "mini.nvim";
}
{
data = cyberdream-nvim;
pname = "cyberdream";
}
{
data = onedark-nvim;
pname = "onedark";
}
{
data = tokyonight-nvim;
pname = "tokyonight";
}
{
data = kanagawa-nvim;
pname = "kanagawa";
}
{
data = gruvbox-nvim;
pname = "gruvbox";
}
{
data = nord-nvim;
pname = "nord";
}
{
data = dracula-nvim;
pname = "dracula";
}
{
data = vscode-nvim;
pname = "vscode";
}
{
data = nightfox-nvim;
pname = "nightfox";
}
{
data = catppuccin-nvim;
pname = "catppuccin";
}
];
};
config.specs.lua = {
data = with pkgs.vimPlugins; [
luvit-meta
{
data = lazydev-nvim;
pname = "lazydev";
}
];
};
config.specs.markdown = {
data = with pkgs.vimPlugins; [
quarto-nvim
render-markdown-nvim
{
data = otter-nvim;
pname = "otter";
}
{
data = zk-nvim;
pname = "zk";
}
];
};
config.specs.utils = {
data = with pkgs.vimPlugins; [
blink-cmp
nvim-lspconfig
nvim-treesitter-context
nvim-treesitter-textobjects
{
data = pkgs.codecompanion-nvim;
pname = "codecompanion";
}
];
};
config.specs.treesitterParsers = {
data = with pkgs.vimPlugins.nvim-treesitter-parsers; [
bash
c
cpp
csv
diff
dockerfile
git_config
git_rebase
gitattributes
gitcommit
gitignore
html
javascript
json
julia
latex
lua
luadoc
make
markdown
markdown_inline
nix
python
query
r
rnoweb
regex
sql
toml
vim
vimdoc
xml
yaml
zig
];
};
config.specs.utils-lazy = {
lazy = true;
data = with pkgs.vimPlugins; [
blink-compat
blink-copilot
cmp-cmdline
colorful-menu-nvim
conform-nvim
copilot-lua
nvim-dap
nvim-dap-ui
nvim-dap-virtual-text
nvim-lint
vim-slime
];
};
config.specs.gitPlugins-lazy = {
lazy = true;
data = [ ];
};
}