refactor package installation

This commit is contained in:
Daniel Winkler 2026-05-23 20:15:23 +10:00
commit a0ba90c4d2
8 changed files with 433 additions and 193 deletions

View file

@ -0,0 +1,109 @@
{
config,
pkgs,
lib,
...
}:
let
maybe = cat: pkgsList:
lib.optionals (config.cats.${cat} or false) pkgsList;
in
{
options.catPkgs = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.package);
description = "Per-cat package lists, gated by cat toggles. Single source of truth for runtimeDeps and devShells.";
};
config.catPkgs = {
always = maybe "always" (with pkgs; [ ]);
clickhouse = maybe "clickhouse" (with pkgs; [ clickhouse-lts ]);
external = maybe "external" (with pkgs; [
perl
ruby
shfmt
sqlfluff
tree-sitter
]);
julia = maybe "julia" [
(pkgs.julia-bin.withPackages config.settings.lang_packages.julia)
];
lua = maybe "lua" (with pkgs; [ lua-language-server ]);
markdown = maybe "markdown" (with pkgs; [
python313Packages.pylatexenc
quarto
zk
]);
nix = maybe "nix" (with pkgs; [
alejandra
nix-doc
nixd
]);
optional = maybe "optional" (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
]);
python = maybe "python" (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 = 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
]);
# cats without packages get empty lists
general = [ ];
gitPlugins = [ ];
treesitterParsers = [ pkgs.tree-sitter ];
utils = [ ];
};
}