From 11fd1b7083136aabbe1ca393616c5d5128bd19a5 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 26 Sep 2025 00:28:21 +0200 Subject: [PATCH] lib/dag: improve dependency cycle error message --- lib/dag.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dag.nix b/lib/dag.nix index cbf52083..db5d53b7 100644 --- a/lib/dag.nix +++ b/lib/dag.nix @@ -8,7 +8,7 @@ # - the addition of the function `entryBefore` indicating a "wanted # by" relationship. {lib}: let - inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString; + inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString removeAttrs; inherit (lib.attrsets) filterAttrs mapAttrs; inherit (lib.lists) toposort; inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort; @@ -169,10 +169,11 @@ in { else value) dag; sortedDag = topoSort finalDag; + loopDetail = map (loops: removeAttrs loops ["data"]) sortedDag.loops; result = if sortedDag ? result then mapResult sortedDag.result - else abort ("Dependency cycle in ${name}: " + toJSON sortedDag); + else abort ("Dependency cycle in ${name}: " + toJSON loopDetail); in result; }