2024-05-31 03:46:32 +02:00
|
|
|
# Sources:
|
|
|
|
# https://github.com/nickkjolsing/dockerMullvadVPN
|
|
|
|
# https://www.reddit.com/r/HomeServer/comments/xapl93/a_minimal_configuration_stepbystep_guide_to_media/
|
2024-04-28 01:14:19 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
let
|
2024-06-13 15:47:36 +02:00
|
|
|
port = config.satellite.ports.qbittorrent;
|
2024-05-29 03:18:16 +02:00
|
|
|
dataDir = "/persist/data/media";
|
2024-04-28 01:14:19 +02:00
|
|
|
configDir = "/persist/state/var/lib/qbittorrent";
|
|
|
|
in
|
|
|
|
{
|
2024-06-13 15:47:36 +02:00
|
|
|
# {{{ Networking & storage
|
|
|
|
satellite.nginx.at.qbit.port = port;
|
2024-05-31 03:46:32 +02:00
|
|
|
sops.secrets.vpn_env.sopsFile = ../secrets.yaml;
|
2024-05-29 03:18:16 +02:00
|
|
|
systemd.tmpfiles.rules = [
|
2024-05-31 03:46:32 +02:00
|
|
|
"d ${dataDir} 777 ${config.users.users.pilot.name} users"
|
|
|
|
"d ${configDir}"
|
2024-05-29 03:18:16 +02:00
|
|
|
];
|
2024-06-13 15:47:36 +02:00
|
|
|
# }}}
|
|
|
|
# {{{ Qbit
|
2024-04-28 01:25:19 +02:00
|
|
|
virtualisation.oci-containers.containers.qbittorrent = {
|
2024-05-31 03:46:32 +02:00
|
|
|
image = "linuxserver/qbittorrent:latest";
|
|
|
|
extraOptions = [ "--network=container:gluetun" ];
|
2024-05-31 05:19:08 +02:00
|
|
|
dependsOn = [ "gluetun" ];
|
2024-05-31 03:46:32 +02:00
|
|
|
volumes = [ "${dataDir}:/downloads" "${configDir}:/config" ];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
WEBUI_PORT = toString port;
|
2024-07-08 03:18:36 +02:00
|
|
|
PUID = toString config.users.users.pilot.uid;
|
|
|
|
PGID = toString config.users.groups.users.gid;
|
2024-07-06 19:32:14 +02:00
|
|
|
TZ = config.time.timeZone;
|
2024-05-31 03:46:32 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
# }}}
|
2024-06-13 15:47:36 +02:00
|
|
|
# {{{ Vpn
|
2024-05-31 03:46:32 +02:00
|
|
|
virtualisation.oci-containers.containers.gluetun = {
|
|
|
|
image = "qmcgaw/gluetun";
|
2024-05-31 01:28:43 +02:00
|
|
|
extraOptions = [
|
2024-06-11 10:50:12 +02:00
|
|
|
"--cap-add=NET_ADMIN"
|
|
|
|
"--cap-add=NET_RAW"
|
2024-05-31 02:15:09 +02:00
|
|
|
"--device=/dev/net/tun"
|
2024-06-11 10:50:12 +02:00
|
|
|
"--sysctl=net.ipv4.conf.all.forwarding=1"
|
2024-05-31 01:28:43 +02:00
|
|
|
];
|
2024-06-11 11:09:24 +02:00
|
|
|
ports = [
|
|
|
|
"${toString port}:${toString port}"
|
|
|
|
"6881:6881"
|
|
|
|
"6881:6881/udp"
|
|
|
|
];
|
2024-05-31 01:28:43 +02:00
|
|
|
|
2024-05-31 04:22:19 +02:00
|
|
|
environmentFiles = [ config.sops.secrets.vpn_env.path ];
|
2024-04-28 01:14:19 +02:00
|
|
|
environment = {
|
2024-06-01 01:19:12 +02:00
|
|
|
VPN_TYPE = "openvpn";
|
2024-05-31 03:46:32 +02:00
|
|
|
VPN_SERVICE_PROVIDER = "mullvad";
|
|
|
|
KILL_SWITCH = "on"; # Turns off internet access if the VPN connection drops
|
2024-04-28 01:14:19 +02:00
|
|
|
};
|
|
|
|
};
|
2024-05-31 03:46:32 +02:00
|
|
|
# }}}
|
2024-04-28 01:14:19 +02:00
|
|
|
}
|