diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index 9b8334a5b9d..e279d6a80f4 100644 --- a/pkgs/lib/lists.nix +++ b/pkgs/lib/lists.nix @@ -177,4 +177,10 @@ rec { let loop = l: if tail l == [] then head l else loop (tail l); in loop list; + # Zip two lists together. + zip = xs: ys: + if xs != [] && ys != [] then + [ {first = head xs; second = head ys;} ] + ++ zip (tail xs) (tail ys) + else []; }