diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index 541ecb3..4cf6d86 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -32,6 +32,7 @@ ./rbackup.nix ./sync-torrent.nix + ./sync-script.nix ]; diff --git a/nixos/machines/chungus/sync-script.nix b/nixos/machines/chungus/sync-script.nix new file mode 100644 index 0000000..d6be10a --- /dev/null +++ b/nixos/machines/chungus/sync-script.nix @@ -0,0 +1,43 @@ +# [ nix-shell:/media/music ]# transmission-create -o ~/first.torrent "Zardonic - Antihero (2015)" -t http://robi.private:6969/announce +# Creating +# torrent "/root/first.torrent" .... done! +# +# [nix-shell:/media/music]# transmission-remote sync.chungus.private:80 -a ~/first.torrent --download-dir /media/music +# sync.chungus.private:80/transmission/rpc/ responded: "success" +# +# [nix-shell:/media/music]# transmission-remote sync.robi.private:80 -a ~/first.torrent --download-dir /media/music +# sync.robi.private:80/transmission/rpc/ responded: "success" +# +# + +{pkgs, ...}: +{ + environment.systemPackages = [ + (pkgs.writers.writeBashBin "torrent-sync" '' + set -e + set -x + + file_folder=$( realpath "$1" ) + folder=$( dirname "$file_folder" ) + file=$( basename "$file_folder" ) + + pushd "$folder" + ${pkgs.transmission}/bin/transmission-create \ + -t udp://robi.private:6969/announce \ + -o ~/last.torrent \ + "$file" + popd + + ${pkgs.transmission}/bin/transmission-remote \ + sync.chungus.private:80 \ + -a ~/last.torrent \ + --download-dir "$folder" + + ${pkgs.transmission}/bin/transmission-remote \ + sync.robi.private:80 \ + -a ~/last.torrent \ + --download-dir "$folder" + + '') + ]; +} \ No newline at end of file diff --git a/nixos/machines/chungus/sync-torrent.nix b/nixos/machines/chungus/sync-torrent.nix index 8177214..332c7f3 100644 --- a/nixos/machines/chungus/sync-torrent.nix +++ b/nixos/machines/chungus/sync-torrent.nix @@ -1,6 +1,8 @@ { lib, pkgs, config, ... }: let uiPort = 9099; + announceIp = "10.23.42.28"; + peerPort = 51433; in { @@ -43,9 +45,9 @@ in # "normal" speed limits speed-limit-down-enabled = false; - speed-limit-down = 800; + speed-limit-down = 1000; speed-limit-up-enabled = true; - speed-limit-up = 3000; + speed-limit-up = 1000; upload-slots-per-torrent = 8; # Queuing # When true, Transmission will only download @@ -66,10 +68,12 @@ in seed-queue-size = 10; # Enable UPnP or NAT-PMP. - peer-port = 51413; + peer-port = peerPort; port-forwarding-enabled = false; - # Start torrents as soon as they are added + announce-ip = announceIp; + announce-ip-enabled = true; + # Start torrents as soon as they are added start-added-torrents = true; }; diff --git a/nixos/machines/robi/sync-torrent.nix b/nixos/machines/robi/sync-torrent.nix index 4f131b9..ee40fe4 100644 --- a/nixos/machines/robi/sync-torrent.nix +++ b/nixos/machines/robi/sync-torrent.nix @@ -1,6 +1,8 @@ { lib, pkgs, config, ... }: let uiPort = 9099; + announceIp = "10.23.42.111"; + peerPort = 51433; in { @@ -66,10 +68,12 @@ in seed-queue-size = 10; # Enable UPnP or NAT-PMP. - peer-port = 51413; + peer-port = peerPort; port-forwarding-enabled = false; - # Start torrents as soon as they are added + announce-ip = announceIp; + announce-ip-enabled = true; + # Start torrents as soon as they are added start-added-torrents = true; };