From 572213f1e76c9e5b0df7b95b1e68a9c4e6544ae7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 1 Aug 2023 16:48:07 +0200 Subject: [PATCH] clanModules: add zerotier --- clanModules/zerotier.nix | 29 +++++++++++++++++++++++++++++ flake-parts/modules.nix | 1 + 2 files changed, 30 insertions(+) create mode 100644 clanModules/zerotier.nix diff --git a/clanModules/zerotier.nix b/clanModules/zerotier.nix new file mode 100644 index 0000000..180b64d --- /dev/null +++ b/clanModules/zerotier.nix @@ -0,0 +1,29 @@ +{ config, lib, ... }: +{ + options.clan.networking.zerotier = { + networkId = lib.mkOption { + type = lib.types.str; + description = '' + zerotier networking id + ''; + }; + }; + config = { + systemd.network.networks.zerotier = { + matchConfig.Name = "zt*"; + networkConfig = { + LLMNR = true; + LLDP = true; + MulticastDNS = true; + KeepConfiguration = "static"; + }; + }; + networking.firewall.allowedUDPPorts = [ 9993 ]; + networking.firewall.interfaces."zt+".allowedTCPPorts = [ 5353 ]; + networking.firewall.interfaces."zt+".allowedUDPPorts = [ 5353 ]; + services.zerotierone = { + enable = true; + joinNetworks = [ config.clan.networking.zerotier.networkId ]; + }; + }; +} diff --git a/flake-parts/modules.nix b/flake-parts/modules.nix index 7cccc93..da9e465 100644 --- a/flake-parts/modules.nix +++ b/flake-parts/modules.nix @@ -7,4 +7,5 @@ writers = ./writers; }; flake.nixosModules = lib.mapAttrs (_: nix: { imports = [ nix ]; }) (self.lib.findNixFiles ../nixosModules); + flake.clanModules = lib.mapAttrs (_: nix: { imports = [ nix ]; }) (self.lib.findNixFiles ../clanModules); }