{ pkgs, ... }:
{
  services.transmission = {
    enable = true;
    settings = {
      rpc-enabled = true;
      rpc-bind-address = "0.0.0.0";
      rpc-whitelist-enabled = false;
      script-torrent-done-enabled = true;
      # Normally, I would write this into the homedir with home-manager
      # And explictly set the dir to be the output of the home-manager location
      # But this seems better, if it'll work?
      script-torrent-done-filename = pkgs.writeShellScript "beet-import.sh" ''
#!/usr/bin/env bash

beet import -ql "$TR_TORRENT_DIR"
      '';
      rpc-url = "/transmission/rpc/";
      download-dir = "/mnt/two/new-music";
    };
  };
  services.nginx.virtualHosts."transmission.mossnet.lan" = {
    enableACME = false;
    forceSSL = false;

    locations."/" = {
      extraConfig = ''
        proxy_pass http://localhost:9091/;
        proxy_set_header X-Forwarded-Host $host;
      '';
    };
  };
}
