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