From b6b039dab59bf7ee6f0856bb5e2953de9d7b1a58 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Sun, 22 Sep 2024 14:43:20 +0300 Subject: [PATCH] feat(lib/util): more functions --- lib/util.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/util.nix b/lib/util.nix index ee9e5a1..992b9be 100644 --- a/lib/util.nix +++ b/lib/util.nix @@ -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; } -- 2.44.1