blob: 03006d863ae4c2e27630c584601da4ffeb95b614 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ libnatpmp gawk dig ];
systemd.services = {
wireguard-torrent = {
bindsTo = [ "netns@torrent.service" ];
after = [ "netns@torrent.service" ];
};
rtorrent = {
bindsTo = [ "wireguard-torrent.service" ];
after = [ "wireguard-torrent.service" ];
unitConfig.JoinsNamespaceOf = "netns@torrent.service";
serviceConfig = {
PrivateNetwork = true;
LimitNOFILE = 24000;
};
path = with pkgs; [ libnatpmp gawk dig findutils gzip ];
};
};
networking.wireguard.interfaces = {
torrent = { # phaenn
ips = [ "10.10.10.2/32" ];
privateKeyFile = "/root/wireguard/torrent.key";
interfaceNamespace = "torrent";
peers = [
{
publicKey = "z0xDKcXtU1koil57vykUK/7RY0EP/QPGesdEzYxM2g0=";
endpoint = "45.152.210.73:51820";
allowedIPs = [ "0.0.0.0/0" ];
persistentKeepalive = 25;
}
];
};
};
services.rtorrent = {
enable = true;
package = pkgs.unstable.rtorrent.overrideAttrs (prev: {
configureFlags = [
"--with-xmlrpc-c"
"--with-posix-fallocate"
];
buildInputs = prev.buildInputs ++ [
pkgs.xmlrpc_c
];
});
# dataDir = "/mnt/media/download";
user = "media";
group = "media";
configText = lib.mkForce (lib.readFile ./rtorrent.rc);
};
}
|