{ config, lib, ... }: let podman = config.profile.podman; qbittorrent = podman.servarr.qbittorrent; name = "qbittorrent-servarr"; ip = "10.88.2.2"; image = "lscr.io/linuxserver/qbittorrent:latest"; root = "/nas/mediaserver/servarr"; configVolume = "${root}/qbittorrent"; mediaVolume = "${root}/data/torrents"; domain = "${name}.tigor.web.id"; user = config.profile.user; uid = toString user.uid; gid = toString user.gid; inherit (lib) mkIf; in { config = mkIf (podman.enable && qbittorrent.enable) { services.caddy.virtualHosts.${domain}.extraConfig = '' reverse_proxy ${ip}:8080 ''; system.activationScripts."podman-${name}" = '' mkdir -p ${configVolume} ${mediaVolume} chown ${uid}:${gid} ${mediaVolume} ${configVolume} ''; virtualisation.oci-containers.containers.${name} = { inherit image; hostname = name; autoStart = true; environment = { PUID = uid; PGID = gid; TZ = "Asia/Jakarta"; WEBUI_PORT = "8080"; TORRENTING_PORT = "6882"; }; volumes = [ "${configVolume}:/config" "${mediaVolume}:/data/torrents" ]; ports = [ "6882:6882" "6882:6882/udp" ]; extraOptions = [ "--ip=${ip}" "--network=podman" ]; labels = { "io.containers.autoupdate" = "registry"; }; }; }; }