Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 47 lines 1.3 kB view raw
1# This file works in tandem with ../../ci/eval/default.nix 2# It turns ./release-outpaths.nix into chunks of a fixed size 3{ 4 lib ? import ../../lib, 5 path ? ../.., 6 # The file containing all available attribute paths, which are split into chunks here 7 attrpathFile, 8 chunkSize, 9 myChunk, 10 checkMeta, 11 includeBroken, 12 systems, 13}: 14 15let 16 attrpaths = lib.importJSON attrpathFile; 17 myAttrpaths = lib.sublist (chunkSize * myChunk) chunkSize attrpaths; 18 19 unfiltered = import ./release-outpaths.nix { 20 inherit path; 21 inherit checkMeta includeBroken systems; 22 }; 23 24 # Turns the unfiltered recursive attribute set into one that is limited to myAttrpaths 25 filtered = 26 let 27 recurse = 28 index: paths: attrs: 29 lib.mapAttrs ( 30 name: values: 31 if attrs ? ${name} then 32 if lib.any (value: lib.length value <= index + 1) values then 33 attrs.${name} 34 else 35 recurse (index + 1) values attrs.${name} 36 # Make sure nix-env recurses as well 37 // { 38 recurseForDerivations = true; 39 } 40 else 41 null 42 ) (lib.groupBy (a: lib.elemAt a index) paths); 43 in 44 recurse 0 myAttrpaths unfiltered; 45 46in 47filtered