diff --git a/fava.nix b/fava.nix index 4abc344..f9958ef 100644 --- a/fava.nix +++ b/fava.nix @@ -5,10 +5,17 @@ with lib; let 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 cfg.package.overridePythonAttrs (old: { - propagatedBuildInputs = (old.propagatedBuildInputs or []) ++ cfg.extensions; + dependencies = (old.dependencies or []) ++ map stripFavaDep cfg.extensions; + dontCheckForDuplicates = true; }); in {