zerotier: delete old networks
All checks were successful
checks-impure / test (pull_request) Successful in 1m30s
checks / test (pull_request) Successful in 2m9s

This commit is contained in:
Jörg Thalheim 2024-01-11 12:56:05 +01:00
parent a5132a4f81
commit 3563b6eaa4

View File

@ -118,6 +118,15 @@ in
mkdir -p /var/lib/zerotier-one/controller.d/network
ln -sfT ${pkgs.writeText "net.json" (builtins.toJSON networkConfig)} /var/lib/zerotier-one/controller.d/network/${cfg.networkId}.json
''}
# cleanup old networks
if [[ -d /var/lib/zerotier-one/networks.d ]]; then
find /var/lib/zerotier-one/networks.d \
-type f \
-name "*.conf" \
-not \( ${lib.concatMapStringsSep " -o " (netId: ''-name "${netId}.conf"'') config.services.zerotierone.joinNetworks} \) \
-delete
fi
''}"
];