···477 */
478 subtractLists = e: filter (x: !(elem x e));
479480+ /* Test if two lists have no common element.
481+ It should be slightly more efficient than (intersectLists a b == [])
482+ */
483+ mutuallyExclusive = a: b:
484+ (builtins.length a) == 0 ||
485+ (!(builtins.elem (builtins.head a) b) &&
486+ mutuallyExclusive (builtins.tail a) b);
487+488}
+1-6
pkgs/stdenv/generic/default.nix
···45 throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
46 ) list;
4748- mutuallyExclusive = a: b:
49- (builtins.length a) == 0 ||
50- (!(builtins.elem (builtins.head a) b) &&
51- mutuallyExclusive (builtins.tail a) b);
52-53 areLicenseListsValid =
54- if mutuallyExclusive whitelist blacklist then
55 assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
56 else
57 throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";
···45 throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
46 ) list;
470000048 areLicenseListsValid =
49+ if lib.mutuallyExclusive whitelist blacklist then
50 assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
51 else
52 throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";