git.delta.rocks / jrsonnet / refs/commits / 89d8c5f2ad38

difftreelog

source

lib/fleetLib.nix811 Bsourcehistory
1# Shared functions for fleet configuration, available as `fleet` module argument2{3  nixpkgs,4  hostNames,5}:6with nixpkgs.lib; rec {7  hostsToAttrs = f:8    listToAttrs (9      map (name: {10        inherit name;11        value = f name;12      })13      hostNames14    );15  hostsCartesian = remove null (16    unique (17      crossLists18      (19        a: b:20          if a == b21          then null22          else hostsPair a b23      ) [hostNames hostNames]24    )25  );26  hostsPair = this: other: let27    sorted = sort (a: b: a < b) [this other];28  in {29    a = elemAt sorted 0;30    b = elemAt sorted 1;31  };32  hostPairName = this: other:33    if this < other34    then "${this}-${other}"35    else "${other}-${this}";3637  # For places, where fleet knows better than nixpkgs defaults38  mkFleetDefault = mkOverride 999;39}