From 43b7e5f4efa6bb6a90179f3eff3aacfa2e879ebb Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 25 Oct 2024 23:01:26 +0530 Subject: [PATCH] layne: run transmission over VPN --- hosts/layne/services/apps/transmission.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/hosts/layne/services/apps/transmission.nix b/hosts/layne/services/apps/transmission.nix index f4f1797..bd62e72 100644 --- a/hosts/layne/services/apps/transmission.nix +++ b/hosts/layne/services/apps/transmission.nix @@ -28,7 +28,7 @@ in "--lpd" ]; settings = { - peer-port = 51515; + peer-port = 35994; rpc-bind-address = "127.0.0.1"; rpc-port = 9091; rpc-host-whitelist = "transmission.labs.adtya.xyz"; @@ -54,4 +54,23 @@ in }; }; systemd.services.transmission.unitConfig.RequiresMountsFor = [ "/mnt/data" ]; + systemd.timers.transmission-port-mapping = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*:*:00/30"; + Unit = "transmission-port-mapping.service"; + }; + }; + + systemd.services.transmission-port-mapping = { + script = '' + set -eu + ${pkgs.libnatpmp}/bin/natpmpc -g 10.2.0.1 -a 1 0 tcp 60 + ${pkgs.libnatpmp}/bin/natpmpc -g 10.2.0.1 -a 1 0 udp 60 + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; }