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

55 lines
1.5 KiB
Nix
Raw Normal View History

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
{
imports = [ ../../common/optional/services/nginx.nix ];
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-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" ];
dependsOn = [ "openvpn-client" ];
volumes = [ "${dataDir}:/downloads" "${configDir}:/config" ];
ports = [ "${toString port}:${toString port}" ];
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 = [
"--cap-add=net_admin"
"--device=/dev/net/tun"
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-05-31 03:46:32 +02:00
VPN_TYPE = "wireguard";
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
}