about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authoropl <4833621+opl@users.noreply.github.com>2024-02-23 21:59:16 +0100
committeropl <4833621+opl@users.noreply.github.com>2024-02-23 22:03:24 +0100
commit877179c89d4195b3751c53e159e8efc14d626fd9 (patch)
tree1ad305206146e44392ce768fa9ac7969d00c548a /nixos/modules/programs
parent899fe5550bd324dd8356c1ef652faf892cefb88e (diff)
downloadnixlib-877179c89d4195b3751c53e159e8efc14d626fd9.tar
nixlib-877179c89d4195b3751c53e159e8efc14d626fd9.tar.gz
nixlib-877179c89d4195b3751c53e159e8efc14d626fd9.tar.bz2
nixlib-877179c89d4195b3751c53e159e8efc14d626fd9.tar.lz
nixlib-877179c89d4195b3751c53e159e8efc14d626fd9.tar.xz
nixlib-877179c89d4195b3751c53e159e8efc14d626fd9.tar.zst
nixlib-877179c89d4195b3751c53e159e8efc14d626fd9.zip
nixos/steam: add localNetworkTransfers.openFirewall option
Steam local network game transfers require TCP port 27040 to be open:
https://steamcommunity.com/groups/SteamClientBeta/discussions/0/3775742015034590856/#c3827537203130812127

They also require UDP port 27036 to allow discovering peers on the same network before a transfer on port 27040 can be initiated.

Co-authored-by: Kira Bruneau <kira.bruneau@pm.me>
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/steam.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix
index 29c449c16946..c7f1e622f7ba 100644
--- a/nixos/modules/programs/steam.nix
+++ b/nixos/modules/programs/steam.nix
@@ -82,6 +82,14 @@ in {
       '';
     };
 
+    localNetworkGameTransfers.openFirewall = mkOption {
+      type = types.bool;
+      default = false;
+      description = lib.mdDoc ''
+        Open ports in the firewall for Steam Local Network Game Transfers.
+      '';
+    };
+
     gamescopeSession = mkOption {
       description = mdDoc "Run a GameScope driven Steam session from your display-manager";
       default = {};
@@ -139,15 +147,23 @@ in {
     ] ++ lib.optional cfg.gamescopeSession.enable steam-gamescope;
 
     networking.firewall = lib.mkMerge [
+      (mkIf (cfg.remotePlay.openFirewall || cfg.localNetworkGameTransfers.openFirewall) {
+        allowedUDPPorts = [ 27036 ]; # Peer discovery
+      })
+
       (mkIf cfg.remotePlay.openFirewall {
         allowedTCPPorts = [ 27036 ];
-        allowedUDPPortRanges = [ { from = 27031; to = 27036; } ];
+        allowedUDPPortRanges = [ { from = 27031; to = 27035; } ];
       })
 
       (mkIf cfg.dedicatedServer.openFirewall {
         allowedTCPPorts = [ 27015 ]; # SRCDS Rcon port
         allowedUDPPorts = [ 27015 ]; # Gameplay traffic
       })
+
+      (mkIf cfg.localNetworkGameTransfers.openFirewall {
+        allowedTCPPorts = [ 27040 ]; # Data transfers
+      })
     ];
   };