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
|
|
|
|
port = 8417;
|
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-11 11:37:14 +02:00
|
|
|
imports = [
|
|
|
|
../../common/optional/services/nginx.nix
|
|
|
|
../../common/optional/oci.nix
|
|
|
|
];
|
2024-04-28 01:14:19 +02:00
|
|
|
|
2024-05-31 03:46:32 +02:00
|
|
|
sops.secrets.vpn_env.sopsFile = ../secrets.yaml;
|
|
|
|
|
2024-04-28 01:14:19 +02:00
|
|
|
services.nginx.virtualHosts."qbit.moonythm.dev" =
|
2024-05-30 04:59:09 +02:00
|
|
|
config.satellite.proxy port { proxyWebsockets = true; };
|
2024-04-28 01:14:19 +02:00
|
|
|
|
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-05-29 23:30:43 +02:00
|
|
|
|
2024-05-31 03:46:32 +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;
|
|
|
|
PGID = "100";
|
|
|
|
PUID = "1000";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# }}}
|
|
|
|
# {{{ vpn
|
|
|
|
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
|
|
|
}
|