nixos-config/legacy/sync-script.nix
2024-06-07 22:56:52 +02:00

31 lines
744 B
Nix

{ 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"
'')
];
}