nix-config/nixos/_mixins/services/firewall.nix
2024-05-23 15:02:20 -04:00

21 lines
469 B
Nix

{ lib, hostname, ... }:
let
# Firewall configuration variable for syncthing
syncthing = {
hosts = [
# "hostname"
];
tcpPorts = [ 22000 ];
udpPorts = [ 22000 21027 ];
};
in
{
networking = {
firewall = {
enable = true;
allowedTCPPorts = lib.optionals (builtins.elem hostname syncthing.hosts) syncthing.tcpPorts;
allowedUDPPorts = lib.optionals (builtins.elem hostname syncthing.hosts) syncthing.udpPorts;
};
};
}