···477477 */
478478 subtractLists = e: filter (x: !(elem x e));
479479480480+ /* Test if two lists have no common element.
481481+ It should be slightly more efficient than (intersectLists a b == [])
482482+ */
483483+ mutuallyExclusive = a: b:
484484+ (builtins.length a) == 0 ||
485485+ (!(builtins.elem (builtins.head a) b) &&
486486+ mutuallyExclusive (builtins.tail a) b);
487487+480488}
+1-6
pkgs/stdenv/generic/default.nix
···4545 throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
4646 ) list;
47474848- mutuallyExclusive = a: b:
4949- (builtins.length a) == 0 ||
5050- (!(builtins.elem (builtins.head a) b) &&
5151- mutuallyExclusive (builtins.tail a) b);
5252-5348 areLicenseListsValid =
5454- if mutuallyExclusive whitelist blacklist then
4949+ if lib.mutuallyExclusive whitelist blacklist then
5550 assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
5651 else
5752 throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";