DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

ref: 89ec3f61c9869ae1e7c489cdf8e191a7b3e90793 nix-arta/lib/util.nix -rw-r--r-- 617 bytes
89ec3f61Jonni Liljamo feat: small tweak to util ip mapping 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{lib, ...}: let
  hostnameIPv4 = {
    vm = {
      "sqbuilds" = "10.1.1.50";
    };

    lxc = {
      "dns" = "10.1.2.3";
      "metrics" = "10.1.2.5";
      "proxy" = "10.1.2.10";
      "auth" = "10.1.2.12";
      "cloud" = "10.1.2.15";
      "social" = "10.1.2.17";
    };
  };

  # getIPv4 "type" "hostname"
  getIPv4 = type: hostname: hostnameIPv4.${type}.${hostname};

  # hostname.home.arpa = ip
  hostnameDNSEntries =
    lib.attrsets.mapAttrs'
    (name: value: lib.attrsets.nameValuePair (name + ".home.arpa") value)
    hostnameIPv4;
in {
  getIPv4 = getIPv4;
  hostnameDNSEntries = hostnameDNSEntries;
}