1
Fork 0
satellite/hosts/nixos/lapetus/services/qbittorrent.nix

51 lines
1.4 KiB
Nix
Raw Normal View History

2024-04-28 01:48:00 +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";
vpnConfigDir = "/persist/state/var/lib/openvpn";
in
{
imports = [ ../../common/optional/services/nginx.nix ];
services.nginx.virtualHosts."qbit.moonythm.dev" =
config.satellite.proxy port { };
2024-05-29 03:18:16 +02:00
systemd.tmpfiles.rules = [
2024-05-30 04:18:24 +02:00
"d ${dataDir} 755 ${config.users.users.pilot.name} users"
2024-05-29 03:18:16 +02:00
"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"
2024-04-28 01:28:46 +02:00
"--device=/dev/net/tun"
2024-04-28 01:14:19 +02:00
];
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
};
};
# }}}
}