This commit is contained in:
mjallen18
2024-08-07 18:41:09 -05:00
parent 26cc1b223f
commit 0fc00e2d29
26 changed files with 683 additions and 202 deletions

View File

@@ -13,36 +13,34 @@ in
config = mkIf cfg.enable {
systemd.services.deluge-docker = {
path = [
pkgs.bash
pkgs.docker
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [
"${toString cfg.port1}:8112"
"${toString cfg.port2}:8118"
"${toString cfg.port3}:58846"
"${toString cfg.port4}:58966"
];
script = ''
set -e
exec docker run \
--rm \
--cap-add=NET_ADMIN \
--name=${cfg.name} \
-e PUID=${cfg.puid} \
-e PGID=${cfg.pgid} \
-e TZ=${cfg.timeZone} \
-p 8112:8112 \
-p 8118:8118 \
-p 58846:58846 \
-p 58946:58966 \
-v '${cfg.configPath}:/config' \
-v '${cfg.moviesPath}:/data/downloads' \
-v '${cfg.tvPath}:/data/downloads-icomplete' \
-v /etc/localtime:/etc/localtime:ro \
-e VPN_ENABLED=yes \
-e VPN_PROV=custom \
-e VPN_CLIENT=openvpn \
-e LAN_NETWORK=10.0.1.0/24 \
-e NAME_SERVERS=1.1.1.1 \
${cfg.image}:latest
'';
wantedBy = [ "multi-user.target" ];
extraOptions = [
"--cap-add=NET_ADMIN"
];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/data/downloads"
"${cfg.tvPath}:/data/downloads-icomplete"
"/etc/localtime:/etc/localtime:ro"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
VPN_ENABLED = "yes";
VPN_PROV = "custom";
VPN_CLIENT = "openvpn";
LAN_NETWORK = "10.0.1.0/24";
NAME_SERVERS = "1.1.1.1";
};
};
};
}

View File

@@ -14,6 +14,26 @@ with lib;
default = "deluge";
};
port1 = mkOption {
type = types.str;
default = "8112";
};
port2 = mkOption {
type = types.str;
default = "8118";
};
port3 = mkOption {
type = types.str;
default = "58846";
};
port4 = mkOption {
type = types.str;
default = "58966";
};
image = mkOption {
type = types.str;
default = "binhex/arch-delugevpn";