From a5dc59600eb0ea8cf1c38aaff27f02efb1d1cb98 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Wed, 1 Apr 2026 23:57:01 -0400 Subject: [PATCH] Use python.withPackages for extensions to avoid conflicts Instead of trying to strip fava from extension dependencies, create a unified Python environment with python.withPackages that includes both fava and all extensions. Python handles deduplication naturally. Co-Authored-By: Claude Opus 4.6 (1M context) --- fava.nix | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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 = {