1 files changed, 10 insertions(+), 6 deletions(-)
M lib/util.nix
M lib/util.nix => lib/util.nix +10 -6
@@ 14,15 14,19 @@
};
};
- # getIPv4 "type" "hostname"
- getIPv4 = type: hostname: hostnameIPv4.${type}.${hostname};
+ # getIPv4 "profile" "hostname"
+ getIPv4 = profile: hostname: hostnameIPv4.${profile}.${hostname};
- # hostname.home.arpa = ip
- hostnameDNSEntries =
+ # getHostnames "profile"
+ getHostnames = profile: builtins.attrNames hostnameIPv4.${profile};
+
+ # getDNSEntries "profile"
+ getDNSEntries = profile:
lib.attrsets.mapAttrs'
(name: value: lib.attrsets.nameValuePair (name + ".home.arpa") value)
- hostnameIPv4;
+ hostnameIPv4.${profile};
in {
getIPv4 = getIPv4;
- hostnameDNSEntries = hostnameDNSEntries;
+ getHostnames = getHostnames;
+ getDNSEntries = getDNSEntries;
}