]> Git — Sourcephile - sourcephile-nix.git/blob - machines/losurdo/transmission.nix
nixpkgs: bump to latest version
[sourcephile-nix.git] / machines / losurdo / transmission.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (config.services) transmission;
4 inherit (config.users) users;
5 inherit (config.security) gnupg;
6 netns = "riseup";
7 in
8 {
9 users.groups.transmission.members = [
10 users."julm".name
11 ];
12 services.netns.namespaces.${netns}.nftables = ''
13 add rule inet filter input tcp dport ${toString transmission.settings.peer-port} counter accept comment "Transmission"
14 add rule inet filter input udp dport ${toString transmission.settings.peer-port} counter accept comment "Transmission"
15 add rule inet filter output meta skuid ${transmission.user} counter accept comment "Transmission"
16 '';
17 #users.groups.keys.members = [ transmission.user ];
18 security.gnupg.secrets."transmission/settings.json" = {
19 user = transmission.user;
20 systemdConfig.before = [ "transmission.service" ];
21 systemdConfig.wantedBy = [ "transmission.service" ];
22 };
23 systemd.services.transmission = {
24 after = [
25 "netns-${netns}.service"
26 "zfs.target"
27 ];
28 requires = [
29 "netns-${netns}.service"
30 "zfs.target"
31 ];
32 serviceConfig.NetworkNamespacePath = "/var/run/netns/${netns}";
33 };
34 services.transmission = {
35 enable = true;
36 performanceNetParameters = true;
37 credentialsFile = gnupg.secrets."transmission/settings.json".path;
38 settings = {
39 message-level = 2;
40 download-dir = "/home/julm/dl/torrents";
41 incomplete-dir = "/home/julm/dl/torrents/.incoming";
42 incomplete-dir-enabled = true;
43 trash-original-torrent-files = false;
44 preallocation = 0;
45 umask = 7; # 007 octal, in decimal!
46 download-queue-enabled = true;
47 download-queue-size = 5;
48 peer-id-ttl-hours = 6;
49 peer-limit-global = 1000;
50 peer-limit-per-torrent = 100;
51
52 peer-port = 6882;
53 peer-port-random-on-start = false;
54 encryption = 1;
55 dht-enabled = true;
56 lpd-enabled = false;
57 pex-enabled = true;
58 port-forwarding-enabled = true;
59 scrape-paused-torrents-enabled = false;
60 peer-socket-tos = "lowcost";
61 queue-stalled-enabled = true;
62 queue-stalled-minutes = 30;
63 speed-limit-down-enabled = false;
64 speed-limit-up = 50;
65 speed-limit-up-enabled = true;
66 alt-speed-enabled = true;
67 alt-speed-time-enabled = true;
68 alt-speed-down = 1000;
69 alt-speed-up = 0;
70 alt-speed-time-day = 127; # all days. 65; # weekend only
71 alt-speed-time-begin = 360; # 06h00 local time
72 alt-speed-time-end = 1320; # 22h00 local time
73 ratio-limit = 4;
74 ratio-limit-enabled = true;
75
76 rpc-enabled = true;
77 rpc-bind-address = "127.0.0.1";
78 rpc-port = 9091;
79 rpc-whitelist = "127.0.0.1";
80 rpc-whitelist-enabled = true;
81 #rpc-authentication-required = true;
82 };
83 };
84 }