This repository has no description
797 B
26 lines
1{ lib, ... }:
2let
3 hosts = lib.mapAttrs (machine: _: {
4 ip = if builtins.pathExists ../machines/${machine}/facts/zerotier-ip then
5 builtins.readFile ../machines/${machine}/facts/zerotier-ip
6 else
7 null;
8 }) (builtins.readDir ../machines);
9
10 filteredHosts = lib.filterAttrs (name: host: host.ip != null) hosts;
11in
12{
13 services.zerotierone.joinNetworks = [ "7c31a21e86f9a75c" ];
14 services.zerotierone.localConf.settings = {
15 interfacePrefixBlacklist = [ "ygg" "mesh" "retiolum" "wiregrill" ];
16 physical = {
17 "10.243.0.0/16".blacklist = true;
18 "10.244.0.0/16".blacklist = true;
19 "42::/16".blacklist = true;
20 };
21 };
22
23 networking.extraHosts = lib.concatMapStringsSep "\n" (host:
24 "${host.value.ip} ${host.name}.z"
25 ) (lib.attrsToList filteredHosts);
26}