From 0f8633dafff1d067ce7f14dfd4bb6c3f45dca8f7 Mon Sep 17 00:00:00 2001 From: tilpner Date: Thu, 11 Nov 2021 11:18:59 +0100 Subject: [PATCH] feat(tools): deduplicate sources by URL --- tools.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools.nix b/tools.nix index 7cd1ff4e..be01d7e0 100644 --- a/tools.nix +++ b/tools.nix @@ -349,7 +349,9 @@ rec { replace-with = "vendored-sources" ''; gitSources = packagesByType."git" or [ ]; - gitSourcesUnique = lib.unique gitSources; + uniqueBy = f: + lib.foldl' (acc: e: if lib.elem (f e) (map f acc) then acc else acc ++ [ e ]) []; + gitSourcesUnique = uniqueBy (c: c.source) gitSources; gitSourceConfigs = builtins.map gitSourceConfig gitSourcesUnique; gitSourceConfigsString = lib.concatStrings gitSourceConfigs; in