Is it possible to make a derivation download a torrent?

I know it would be a really bad idea, and there would be basically no way to do it hermetically, but I’m imagining a “fetcher” that connects via RPC to a running Transmission daemon and tells it to download a torrent with the output path set to $out, waits for the torrent to finish, then returns, leaving the torrented files where the Transmission daemon put them. Transmission would continue to seed them after the Nix daemon set the directory to read-only, and all would be good.

That fetcher would fail to run unless there was a Transmission daemon running on the local machine without an RPC password, and it would violate the Nix philosophy six ways from Sunday, but it would be possible, and now I can’t get the idea out of my head.

Can someone please convince me that I shouldn’t do this?

(I don’t even think it would work if you just declared Transmission as a dependency, spawned it, then killed it when the download was done, because it’d need to be allowed through the firewall.)

Try pkgs.fetchtorrent, which uses transmission (or rqbit, if you prefer) as the backend.

1 Like