2024-04-28 01:14:19 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
let
|
|
|
|
port = 8417;
|
|
|
|
dataDir = "/persist/data/home/adrielus/media";
|
|
|
|
configDir = "/persist/state/var/lib/qbittorrent";
|
|
|
|
vpnConfigDir = "/persist/state/var/lib/openvpn";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [ ../../common/optional/services/nginx.nix ];
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."qbit.moonythm.dev" =
|
|
|
|
config.satellite.proxy port { };
|
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [ "d ${dataDir}" "d ${configDir}" ];
|
2024-04-28 01:25:19 +02:00
|
|
|
virtualisation.oci-containers.containers.qbittorrent = {
|
2024-04-28 01:14:19 +02:00
|
|
|
image = "linuxserver/qbittorrent:latest";
|
|
|
|
extraOptions = [ "--network=container:openvpn-client" ];
|
|
|
|
dependsOn = [ "openvpn-client" ];
|
|
|
|
volumes = [ "${dataDir}:/downloads" "${configDir}:/config" ];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
WEBUI_PORT = toString port;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# {{{ open-vpn
|
2024-04-28 01:25:19 +02:00
|
|
|
virtualisation.oci-containers.containers.openvpn-client = {
|
2024-04-28 01:14:19 +02:00
|
|
|
image = "ghcr.io/wfg/openvpn-client";
|
|
|
|
extraOptions = [
|
|
|
|
"--network=bridge"
|
|
|
|
"--cap-add=net_admin"
|
|
|
|
"--devices=/dev/net/tun"
|
|
|
|
];
|
|
|
|
|
|
|
|
volumes = [ "${vpnConfigDir}:/data/vpn" ];
|
2024-04-28 01:23:59 +02:00
|
|
|
ports = [ "${toString port}:${toString port}" ];
|
2024-04-28 01:14:19 +02:00
|
|
|
|
|
|
|
environment = {
|
|
|
|
KILL_SWITCH = "on"; # Turns off internet access if the VPN connection drops
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# }}}
|
|
|
|
}
|