summary refs log tree commit diff
path: root/nixos/modules/services/games
diff options
context:
space:
mode:
authorlegendofmiracles <legendofmiracles@protonmail.com>2021-05-20 03:43:17 -0600
committerJonathan Ringer <jonringer@users.noreply.github.com>2021-05-20 12:11:08 -0700
commitaf0a54285ed4ff131f205517aeafb94a9a5898cb (patch)
tree66aee9077b114482ebea553dcd48b3e7ea3d2e7d /nixos/modules/services/games
parent9b0d67c40e20ff5a60df4fe5d459c533e3c70280 (diff)
downloadnixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.tar
nixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.tar.gz
nixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.tar.bz2
nixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.tar.lz
nixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.tar.xz
nixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.tar.zst
nixpkgs-af0a54285ed4ff131f205517aeafb94a9a5898cb.zip
nixos/terraria: open ports in the firewall
Diffstat (limited to 'nixos/modules/services/games')
-rw-r--r--nixos/modules/services/games/terraria.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/services/games/terraria.nix b/nixos/modules/services/games/terraria.nix
index 34c8ff137d6..9e8e5ae8759 100644
--- a/nixos/modules/services/games/terraria.nix
+++ b/nixos/modules/services/games/terraria.nix
@@ -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 ];
+    };
+
   };
 }