{ lib, pkgs, config, ... }: with lib; let cfg = config.nas-apps.deluge; in { imports = [ ./options.nix ]; config = mkIf cfg.enable { 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" ]; 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"; }; }; }; }