Merge pull request #104773 from adisbladis/texlive-unique

texlive: Use lib.unique for uniqueness checks
This commit is contained in:
Eelco Dolstra 2020-11-24 16:26:17 +01:00 committed by GitHub
commit 4160889b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,13 +31,7 @@ let
++ lib.optional (lib.any pkgNeedsRuby splitBin.wrong) ruby; ++ lib.optional (lib.any pkgNeedsRuby splitBin.wrong) ruby;
}; };
# TODO: replace by buitin once it exists uniqueStrings = list: lib.sort (a: b: a < b) (lib.unique list);
fastUnique = comparator: list: with lib;
let un_adj = l: if length l < 2 then l
else optional (head l != elemAt l 1) (head l) ++ un_adj (tail l);
in un_adj (lib.sort comparator list);
uniqueStrings = fastUnique (a: b: a < b);
mkUniqueOutPaths = pkgs: uniqueStrings mkUniqueOutPaths = pkgs: uniqueStrings
(map (p: p.outPath) (builtins.filter lib.isDerivation pkgs)); (map (p: p.outPath) (builtins.filter lib.isDerivation pkgs));