nvimConfig/modules/module/settings/lang-packages.nix
Daniel Winkler 9a6e20110e Make settings.lang_packages append instead of replace
Downstream modules assign settings.lang_packages.<lang> plainly, which
out-priorities mkOptionDefault and silently dropped the built-in
defaults (e.g. lintr, breaking R linting in downstream wrappers like the
project-template ed flake).

Move the built-in defaults into a separate settings.langPackageDefaults
option and compose defaults ++ lang_packages at the consumption sites
(catPkgs r/python/julia, quarto extraRPackages, neovide R host). A new
append-semantics check fails if defaults migrate back into lang_packages.

Also fix pre-existing inverted assertions in downstream-overrides check:
the override module sets cats.r = true, so assert presence, not absence.
2026-08-25 11:33:02 +10:00

81 lines
2.2 KiB
Nix

{
config,
pkgs,
lib,
...
}:
{
options.settings = {
# Built-in language libraries composed into every language spec.
# Consumers extend via settings.lang_packages, which is APPENDED to these.
langPackageDefaults = lib.mkOption {
type = lib.types.submodule {
options = {
python = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
};
r = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
};
julia = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
};
default = { };
};
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 = ''
Project-specific language libraries. Appended to settings.langPackageDefaults
in each language spec's runtime packages.
'';
};
};
config.settings.langPackageDefaults = {
python = with pkgs.python3Packages; [
duckdb
polars
];
r = with pkgs.rpkgs.rPackages; [
arrow
broom
data_table
janitor
styler
# vscDebugger is not on CRAN/Bioconductor, so it is not available in
# pkgs.rpkgs.rPackages. Install it manually in your R library if you
# want to use the nvim-dap R adapter (see plugin/26_dap.lua).
# vscDebugger
lintr
];
julia = [
"DataFramesMeta"
"QuackIO"
];
};
}