Fix duplicate fava package conflict with extensions

Extensions like fava-dashboards depend on fava, causing a duplicate
package error when added to fava's own dependencies. Strip the fava
dependency from extensions since they're already running inside
fava's Python environment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-04-01 23:24:13 -04:00
parent 1c7daeef9c
commit 2c5867fcd3

View file

@ -5,10 +5,17 @@ with lib;
let let
cfg = config.services.fava; cfg = config.services.fava;
# Build fava with extensions included in its Python environment # Build fava with extensions included in its Python environment.
# Extensions that depend on fava are overridden to remove it from their
# dependencies, avoiding duplicate package conflicts in the closure.
stripFavaDep = ext: ext.overridePythonAttrs (old: {
dependencies = builtins.filter (dep: (dep.pname or "") != "fava") (old.dependencies or []);
});
favaWithExtensions = if cfg.extensions == [] then cfg.package else favaWithExtensions = if cfg.extensions == [] then cfg.package else
cfg.package.overridePythonAttrs (old: { cfg.package.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or []) ++ cfg.extensions; dependencies = (old.dependencies or []) ++ map stripFavaDep cfg.extensions;
dontCheckForDuplicates = true;
}); });
in { in {