This repository has no description
534 B
19 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;
11
12in
13{
14 clan.networking.zerotier.networkId = "7c31a21e86f9a75c";
15
16 networking.extraHosts = lib.concatMapStringsSep "\n" (host:
17 "${host.value.ip} ${host.name}.z"
18 ) (lib.attrsToList filteredHosts);
19}