2024-05-14 08:39:54 -03:00
|
|
|
{ config, pkgs, lib, options, ... }:
|
|
|
|
|
2024-05-11 12:53:09 -03:00
|
|
|
let
|
2024-05-14 18:33:28 -03:00
|
|
|
privateZeroTierInterfaces = [ "zt_aura" ]; # ZT NET INTERFACE
|
2024-05-11 12:53:09 -03:00
|
|
|
in {
|
|
|
|
|
|
|
|
networking.firewall.trustedInterfaces = privateZeroTierInterfaces; # TRUST VPN ONLY
|
|
|
|
|
2024-05-18 21:20:55 -03:00
|
|
|
services.avahi = {
|
|
|
|
enable = true;
|
2024-05-24 07:53:23 -03:00
|
|
|
#allowInterfaces = privateZeroTierInterfaces; # ONLY BROADCAST ON VPN
|
2024-05-18 21:20:55 -03:00
|
|
|
ipv6 = true;
|
|
|
|
publish.enable = true;
|
|
|
|
publish.userServices = true;
|
|
|
|
publish.addresses = true;
|
|
|
|
publish.domain = true;
|
|
|
|
nssmdns4 = true;
|
|
|
|
publish.workstation = true; # ADDED TO DESKTOP MACHINES
|
|
|
|
cacheEntriesMax = 512;
|
|
|
|
};
|
2024-05-14 18:33:28 -03:00
|
|
|
|
|
|
|
systemd.services.createDevicemap = {
|
|
|
|
description = "Create ZeroTier devicemap file";
|
|
|
|
before = [ "zerotierone.service" ]; # Ensure ZeroTier service has started
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
};
|
|
|
|
script = ''
|
|
|
|
mkdir -p /var/lib/zerotier-one
|
|
|
|
echo "e04fa485ed2a4dc4=zt_aura" > /var/lib/zerotier-one/devicemap
|
|
|
|
'';
|
|
|
|
};
|
2024-05-11 12:53:09 -03:00
|
|
|
|
|
|
|
services.zerotierone.enable = true;
|
2024-05-11 15:17:01 -03:00
|
|
|
|
|
|
|
#Don't join zerotier if I'm testing in a VM
|
2024-05-14 08:39:54 -03:00
|
|
|
services.zerotierone.joinNetworks = lib.optionals (!options.virtualisation ? qemu) [ "e04fa485ed2a4dc4" ];
|
2024-05-11 12:53:09 -03:00
|
|
|
}
|