DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

ref: 065f55257a7d1df9c0d2cc9257dbe813b65c0e9f nix-arta/lib/util.nix -rw-r--r-- 760 bytes
065f5525Jonni Liljamo feat: LXC docs, base LXC, use NixOS LXC module a month 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
29
30
31
32
{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 "profile" "hostname"
  getIPv4 = profile: hostname: hostnameIPv4.${profile}.${hostname};

  # 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.${profile};
in {
  getIPv4 = getIPv4;
  getHostnames = getHostnames;
  getDNSEntries = getDNSEntries;
}