nixos/terraria: open ports in the firewall

This commit is contained in:
legendofmiracles 2021-05-20 03:43:17 -06:00 committed by Jonathan Ringer
parent 9b0d67c40e
commit af0a54285e

View file

@ -111,6 +111,13 @@ in
default = false;
description = "Disables automatic Universal Plug and Play.";
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = "Wheter to open ports in the firewall";
};
dataDir = mkOption {
type = types.str;
default = "/var/lib/terraria";
@ -151,5 +158,11 @@ in
${pkgs.coreutils}/bin/chgrp terraria ${cfg.dataDir}/terraria.sock
'';
};
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
allowedUDPPorts = [ cfg.port ];
};
};
}