diff --git a/fava.nix b/fava.nix index 74aca88..489afd6 100644 --- a/fava.nix +++ b/fava.nix @@ -5,19 +5,14 @@ with lib; let cfg = config.services.fava; - # 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 []); - dontCheckRuntimeDeps = true; - }); - + # Build a Python environment with fava and all extensions. + # This avoids duplicate package conflicts by letting Python resolve + # shared dependencies (like fava itself) in a single environment. + python = cfg.package.pythonModule; favaWithExtensions = if cfg.extensions == [] then cfg.package else - cfg.package.overridePythonAttrs (old: { - dependencies = (old.dependencies or []) ++ map stripFavaDep cfg.extensions; - dontCheckForDuplicates = true; - }); + let + env = python.withPackages (ps: [ cfg.package ] ++ cfg.extensions); + in env; in { options.services.fava = {