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