Files
nix-dotfiles/systems/palatine-hill/docker/torr.nix

144 lines
3.3 KiB
Nix
Raw Normal View History

2025-06-01 15:04:11 -04:00
{ config, pkgs, ... }:
let
2026-01-07 22:16:01 -05:00
qbitBase = {
image = "ghcr.io/linuxserver/qbittorrent:latest";
pull = "always";
environment = {
PUID = "600";
PGID = "100";
TZ = "America/New_York";
};
};
vars = import ../vars.nix;
#docker_path = vars.primary_docker;
torr_path = vars.primary_torr;
2026-01-07 22:16:01 -05:00
qbit_path = "${torr_path}/qbit";
qbitvpn_path = "${torr_path}/qbitvpn";
qbitperm_path = "${torr_path}/qbitperm";
in
{
2025-06-01 15:51:40 -04:00
virtualisation.oci-containers.containers = {
2026-01-07 22:16:01 -05:00
qbit = qbitBase // {
2026-01-07 23:03:17 -05:00
# webui port is 8082, torr port is 29432
2026-01-07 22:16:01 -05:00
environment = qbitBase.environment // {
WEBUI_PORT = "8082";
2026-01-07 23:20:51 -05:00
TORRENTING_PORT = "29432";
2026-01-07 22:16:01 -05:00
};
volumes = [
2026-01-07 22:16:01 -05:00
"${qbit_path}/config:/config" # move from docker/qbit to qbit_path
2026-01-08 16:28:54 -05:00
"${torr_path}/data/:/data"
"/etc/localtime:/etc/localtime:ro"
];
2026-01-08 11:45:15 -05:00
networks = [ "host" ];
ports = [
2026-01-07 23:18:10 -05:00
"8082:8082"
2026-01-07 22:16:01 -05:00
"29432:29432"
2026-01-07 23:20:51 -05:00
"29432:29432/udp"
];
2026-01-08 16:28:54 -05:00
extraOptions = [
"--dns=9.9.9.9"
];
};
2026-01-10 01:07:18 -05:00
# temp instance
2026-01-07 22:16:01 -05:00
qbitVPN = qbitBase // {
2026-01-07 23:03:17 -05:00
# webui port is 8081, torr port is 39274
2026-01-07 22:16:01 -05:00
networks = [
"container:gluetun-qbit"
];
2026-01-07 23:20:51 -05:00
environment = qbitBase.environment // {
WEBUI_PORT = "8081";
};
2026-01-07 22:16:01 -05:00
dependsOn = [ "gluetun-qbit" ];
volumes = [
2026-01-07 22:16:01 -05:00
"${qbitvpn_path}/config:/config"
2026-01-08 16:28:54 -05:00
"${torr_path}/data:/data"
"/etc/localtime:/etc/localtime:ro"
];
2026-01-07 22:16:01 -05:00
};
2026-01-10 01:07:18 -05:00
gluetun-qbit = {
image = "qmcgaw/gluetun:v3";
capabilities = {
NET_ADMIN = true;
};
devices = [
"/dev/net/tun:/dev/net/tun"
];
ports = [
"8081:8081"
"8083:8083"
];
environment = {
TZ = "America/New_York";
# SOPS prep
};
environmentFiles = [
config.sops.secrets."docker/gluetun".path
config.sops.secrets."docker/gluetun-qbitvpn".path
];
};
# permanent instance
2026-01-07 22:16:01 -05:00
qbitPerm = qbitBase // {
# webui port is 8083, torr port is 29434
networks = [
"container:gluetun-qbit"
];
2026-01-07 23:20:51 -05:00
environment = qbitBase.environment // {
WEBUI_PORT = "8083";
};
2026-01-07 22:16:01 -05:00
dependsOn = [ "gluetun-qbit" ];
volumes = [
"${qbitperm_path}/config:/config"
2026-01-08 16:28:54 -05:00
"${torr_path}/data:/data"
2026-01-07 22:16:01 -05:00
"/etc/localtime:/etc/localtime:ro"
];
};
2026-01-10 01:07:18 -05:00
gluetun-qbitperm = {
2026-01-07 22:16:01 -05:00
image = "qmcgaw/gluetun:v3";
capabilities = {
2026-01-07 22:56:55 -05:00
NET_ADMIN = true;
2026-01-07 22:16:01 -05:00
};
devices = [
"/dev/net/tun:/dev/net/tun"
];
ports = [
"8083:8083"
];
environment = {
TZ = "America/New_York";
# SOPS prep
};
environmentFiles = [
config.sops.secrets."docker/gluetun".path
2026-01-10 01:07:18 -05:00
config.sops.secrets."docker/gluetun-qbitperm".path
2025-06-01 15:22:05 -04:00
];
};
};
2026-01-07 22:16:01 -05:00
sops.secrets = {
"docker/gluetun" = {
2025-06-01 15:51:40 -04:00
owner = "docker-service";
2026-01-10 01:07:18 -05:00
restartUnits = [
"docker-gluetun-qbit.service"
"docker-gluetun-qbitperm.service"
];
};
"docker/gluetun-qbitvpn" = {
owner = "docker-service";
restartUnits = [
"docker-gluetun-qbit.service"
];
};
"docker/gluetun-qbitperm" = {
owner = "docker-service";
restartUnits = [
"docker-gluetun-qbitperm.service"
];
2025-06-01 15:51:40 -04:00
};
2025-06-01 15:04:11 -04:00
};
}