From 897633db1303838298362d369148242b5b79da28 Mon Sep 17 00:00:00 2001 From: sefidel Date: Sun, 25 Feb 2024 07:37:04 +0900 Subject: feat(modules): add transmission --- modules/services/transmission.nix | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 modules/services/transmission.nix (limited to 'modules') diff --git a/modules/services/transmission.nix b/modules/services/transmission.nix new file mode 100644 index 0000000..e32ca6a --- /dev/null +++ b/modules/services/transmission.nix @@ -0,0 +1,53 @@ +{ config, lib, ... }: + +with lib; +let + cfg = config.modules.services.transmission; +in +{ + options.modules.services.transmission = { + enable = mkEnableOption ""; + + home = mkOption { type = types.str; }; + secrets.transmission-extra-config = mkOption { + type = types.path; + description = '' + Path to the secret file containing the extra config JSON. + Useful for setting passwords (`rpc-password`). + Hashed password should be used as transmission will try to + rewrite the config with hashed password if plaintext password + is used. Hashed password starts with the character `{`. + ''; + }; + }; + + config = mkIf cfg.enable { + services.transmission = { + enable = true; + + home = cfg.home; + + settings = { + # Require encrypted connections + encryption = 2; + + # Web interface + rpc-port = 4006; + rpc-authentication-required = true; + # Managed via external ACL + rpc-host-whitelist-enabled = false; + + # Start torrents as soon as they are added + start-added-torrents = true; + + incomplete-dir-enabled = true; + incomplete-dir = "${cfg.home}/incomplete"; + download-dir = "${cfg.home}/downloads"; + watch-dir-enabled = false; + watch-dir = "${cfg.home}/watch"; + }; + + credentialsFile = cfg.secrets.transmission-extra-config; + }; + }; +} -- cgit 1.4.1