lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Avoid top-level `with ...;` in lib/systems/inspect.nix

+25 -13
+25 -13
lib/systems/inspect.nix
··· 1 1 { lib }: 2 2 3 - with lib.attrsets; 4 - with lib.lists; 5 - 6 3 let 4 + inherit (lib) 5 + any 6 + attrValues 7 + concatMap 8 + filter 9 + hasPrefix 10 + isList 11 + mapAttrs 12 + matchAttrs 13 + recursiveUpdateUntil 14 + toList 15 + ; 16 + 17 + inherit (lib.strings) toJSON; 18 + 7 19 inherit (lib.systems.parse) 8 20 kernels 9 21 kernelFamilies ··· 12 24 execFormats 13 25 ; 14 26 15 - abis = lib.mapAttrs (_: abi: builtins.removeAttrs abi [ "assertions" ]) lib.systems.parse.abis; 27 + abis = mapAttrs (_: abi: removeAttrs abi [ "assertions" ]) lib.systems.parse.abis; 16 28 in 17 29 18 30 rec { ··· 41 53 isx86 = { cpu = { family = "x86"; }; }; 42 54 isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; 43 55 isArmv7 = map ({ arch, ... }: { cpu = { inherit arch; }; }) 44 - (lib.filter (cpu: lib.hasPrefix "armv7" cpu.arch or "") 45 - (lib.attrValues cpuTypes)); 56 + (filter (cpu: hasPrefix "armv7" cpu.arch or "") 57 + (attrValues cpuTypes)); 46 58 isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; 47 59 isAarch = { cpu = { family = "arm"; }; }; 48 60 isMicroBlaze = { cpu = { family = "microblaze"; }; }; ··· 120 132 let 121 133 # patterns can be either a list or a (bare) singleton; turn 122 134 # them into singletons for uniform handling 123 - pat1 = lib.toList pat1_; 124 - pat2 = lib.toList pat2_; 135 + pat1 = toList pat1_; 136 + pat2 = toList pat2_; 125 137 in 126 - lib.concatMap (attr1: 138 + concatMap (attr1: 127 139 map (attr2: 128 - lib.recursiveUpdateUntil 140 + recursiveUpdateUntil 129 141 (path: subattr1: subattr2: 130 142 if (builtins.intersectAttrs subattr1 subattr2) == {} || subattr1 == subattr2 131 143 then true 132 144 else throw '' 133 145 pattern conflict at path ${toString path}: 134 - ${builtins.toJSON subattr1} 135 - ${builtins.toJSON subattr2} 146 + ${toJSON subattr1} 147 + ${toJSON subattr2} 136 148 '') 137 149 attr1 138 150 attr2 ··· 141 153 pat1; 142 154 143 155 matchAnyAttrs = patterns: 144 - if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns 156 + if isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns 145 157 else matchAttrs patterns; 146 158 147 159 predicates = mapAttrs (_: matchAnyAttrs) patterns;