From 45edaf673ca5ef09e32b1b695191e0642e47872b Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Wed, 1 Jan 2020 16:24:36 -0700 Subject: [PATCH] modules#qbittorrent: add `openFirewall` option --- modules/services/torrent/qbittorrent.nix | 13 +++++++++++++ profiles/misc/torrent.nix | 1 + 2 files changed, 14 insertions(+) diff --git a/modules/services/torrent/qbittorrent.nix b/modules/services/torrent/qbittorrent.nix index 4c3d1ad..8f9f45c 100644 --- a/modules/services/torrent/qbittorrent.nix +++ b/modules/services/torrent/qbittorrent.nix @@ -47,6 +47,14 @@ in ''; }; + openFirewall = mkOption { + type = types.bool; + default = false; + description = '' + Open services.qBittorrent.port to the outside network. + ''; + }; + openFilesLimit = mkOption { default = openFilesLimit; description = '' @@ -67,6 +75,11 @@ in ) ]; + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [ cfg.port ]; + allowedUDPPorts = [ cfg.port ]; + }; + systemd.services.qbittorrent = { after = [ "network.target" ]; description = "qBittorrent Daemon"; diff --git a/profiles/misc/torrent.nix b/profiles/misc/torrent.nix index 3337af2..6bebe2d 100644 --- a/profiles/misc/torrent.nix +++ b/profiles/misc/torrent.nix @@ -7,6 +7,7 @@ in services.qbittorrent = { enable = true; group = "media"; + openFirewall = true; }; users.groups.media.members = [ "qbittorrent" ];