nix-helpers: 9325dd1f8b74459c4db26f96e7244a74f5d3b382

     1: # Pinned nixpkgs repos
     2: { nixpkgs-lib ? import ../nixpkgs-lib { } }:
     3: with rec {
     4:   inherit (builtins) abort attrNames compareVersions getAttr;
     5:   inherit (nixpkgs-lib)
     6:     filterAttrs foldl' hasPrefix mapAttrs' replaceStrings stringLength;
     7: 
     8:   repos = filterAttrs (n: _: hasPrefix "repo" n && stringLength n == 8)
     9:     (import ../../nix/sources.nix);
    10: 
    11:   pkgSets = mapAttrs' (n: v: {
    12:     name = replaceStrings [ "repo" ] [ "nixpkgs" ] n;
    13:     value = import v ({
    14:       config = { };
    15:     } // (if compareVersions n "repo1703" == -1 then
    16:       { }
    17:     else {
    18:       overlays = [ ];
    19:     }));
    20:   }) repos;
    21: 
    22:   latest = attrs:
    23:     with {
    24:       attr = foldl' (found: name:
    25:         if found == null || compareVersions name found == 1 then
    26:           name
    27:         else
    28:           found) null (attrNames attrs);
    29:     };
    30:     assert attr != null || abort "Can't get latest from empty set";
    31:     getAttr attr attrs;
    32: };
    33: 
    34: repos // pkgSets // {
    35:   repoLatest = latest repos;
    36:   nixpkgsLatest = latest pkgSets;
    37: }

Generated by git2html.