infrastructure/nixos/hosts/hades/rtorrent/configuration.nix

54 lines
1.5 KiB
Nix
Raw Normal View History

2022-10-02 23:33:47 +02:00
{ config, pkgs, ... }:
2022-12-01 22:13:05 +01:00
let vs = config.vault-secrets.secrets;
in {
imports = [ ./rtorrent.nix ];
2022-10-02 23:33:47 +02:00
networking.interfaces.eth0.useDHCP = true;
system.stateVersion = "22.05";
2023-11-26 17:29:50 +01:00
networking.firewall.allowedTCPPorts = [ config.services.rtorrent.port ];
networking.firewall.allowedUDPPorts = [ config.services.rtorrent.port ];
2022-10-02 23:33:47 +02:00
fileSystems."/mnt/storage" = {
device = "storage:/mnt/storage";
fsType = "nfs";
};
services.flood = {
enable = true;
host = "0.0.0.0";
openFirewall = true;
2022-12-01 22:13:05 +01:00
inherit (config.services.rtorrent) downloadDir;
2022-10-02 23:33:47 +02:00
};
2022-12-01 22:13:05 +01:00
vault-secrets.secrets.rtorrent = { services = [ "wg-quick-wg0" ]; };
2022-10-02 23:33:47 +02:00
2023-09-25 11:56:02 +02:00
networking.wg-quick.interfaces =
let
postUpScript = pkgs.writeScriptBin "post_up" ''
#!${pkgs.stdenv.shell}
${pkgs.iproute2}/bin/ip route add 10.42.42.0/23 via 192.168.0.1
${pkgs.iproute2}/bin/ip route add 10.100.0.0/24 via 192.168.0.1
'';
in
{
wg0 = {
2023-11-26 11:32:36 +01:00
address = [ "10.129.112.89/32, fd7d:76ee:e68f:a993:edd1:668b:49f7:b7c3/128" ];
mtu = 1320;
dns = [ "10.128.0.1" "fd7d:76ee:e68f:a993::1" ];
2023-09-25 11:56:02 +02:00
privateKeyFile = "${vs.rtorrent}/wireguardKey";
postUp = "${postUpScript}/bin/post_up || true";
2022-10-02 23:33:47 +02:00
2023-09-25 11:56:02 +02:00
peers = [
{
2023-11-26 11:32:36 +01:00
publicKey = "PyLCXAQT8KkM4T+dUsOQfn+Ub3pGxfGlxkIApuig+hk=";
2023-09-25 11:56:02 +02:00
allowedIPs = [ "0.0.0.0/0" "::/0" ];
2023-11-26 11:32:36 +01:00
endpoint = "europe3.vpn.airdns.org:1637";
presharedKeyFile = "${vs.rtorrent}/presharedKey";
persistentKeepalive = 15;
2023-09-25 11:56:02 +02:00
}
];
};
2022-10-02 23:33:47 +02:00
};
}