nvimConfig/modules/module/settings/env.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

30 lines
1.1 KiB
Nix

{
config,
pkgs,
lib,
...
}: {
# Environment variables set for the wrapper.
# These are available when running neovim.
config.env = lib.mkMerge [
(lib.mkIf (config.cats.python or false) {
UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = pkgs.python.interpreter;
})
# R.nvim v1.x owns its cache and temporary directories and exports
# RNVIM_COMPLDIR/RNVIM_TMPDIR during setup. Do not inject literal `$PWD`
# values into the wrapper environment.
#
# ponytail: with R_LIBS_USER unset-or-empty, loading compiled namespaces
# (S7 via btw) segfaults on macOS for bare-terminal launches outside the
# devShell hook. Any non-empty value avoids it; this store path exists,
# contains no libraries, and stays inert. The devShell hook overrides it
# with $PWD/.r-libs. Upgrade path: teach wlib to emit expandable defaults.
(lib.mkIf (config.cats.r or false) {
R_LIBS_USER = "${pkgs.rpkgs.rWrapper}";
})
];
# Environment variables with defaults (can be overridden by user)
config.envDefault = lib.mkMerge [ ];
}