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) <noreply@anthropic.com>
This commit is contained in:
parent
97f8f97ca2
commit
a5dc59600e
1 changed files with 7 additions and 12 deletions
19
fava.nix
19
fava.nix
|
|
@ -5,19 +5,14 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.fava;
|
cfg = config.services.fava;
|
||||||
|
|
||||||
# Build fava with extensions included in its Python environment.
|
# Build a Python environment with fava and all extensions.
|
||||||
# Extensions that depend on fava are overridden to remove it from their
|
# This avoids duplicate package conflicts by letting Python resolve
|
||||||
# dependencies, avoiding duplicate package conflicts in the closure.
|
# shared dependencies (like fava itself) in a single environment.
|
||||||
stripFavaDep = ext: ext.overridePythonAttrs (old: {
|
python = cfg.package.pythonModule;
|
||||||
dependencies = builtins.filter (dep: (dep.pname or "") != "fava") (old.dependencies or []);
|
|
||||||
dontCheckRuntimeDeps = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
favaWithExtensions = if cfg.extensions == [] then cfg.package else
|
favaWithExtensions = if cfg.extensions == [] then cfg.package else
|
||||||
cfg.package.overridePythonAttrs (old: {
|
let
|
||||||
dependencies = (old.dependencies or []) ++ map stripFavaDep cfg.extensions;
|
env = python.withPackages (ps: [ cfg.package ] ++ cfg.extensions);
|
||||||
dontCheckForDuplicates = true;
|
in env;
|
||||||
});
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.services.fava = {
|
options.services.fava = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue