diff options
author | sefidel <contact@sefidel.net> | 2024-02-25 07:37:04 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2024-03-06 17:43:45 +0900 |
commit | 897633db1303838298362d369148242b5b79da28 (patch) | |
tree | eddb8760062c5fcc1e8e26b6d2a16b3f6adc81c9 | |
parent | 2ba4a43031c3b167826ce345cd79339c9be7b812 (diff) | |
download | nixrc-897633db1303838298362d369148242b5b79da28.tar.gz nixrc-897633db1303838298362d369148242b5b79da28.zip |
feat(modules): add transmission
-rw-r--r-- | modules/services/transmission.nix | 53 |
1 files changed, 53 insertions, 0 deletions
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; + }; + }; +} |