{ lib, config, namespace, ... }: with lib; let inherit (lib.${namespace}) mkOpt mkReverseProxyOpt; cfg = config.${namespace}.services.unmanic; in { options.${namespace}.services.unmanic = { enable = mkEnableOption "unmanic service"; name = mkOpt types.str "unmanic" "container name"; image = mkOpt types.str "josh5/unmanic" "container image"; port = mkOpt types.int 8265 "Port for unmanic to be hosted on"; configPath = mkOpt types.str "" "Path to the data dir"; moviesPath = mkOpt types.str "" "Path to the data dir"; tvPath = mkOpt types.str "" "Path to the data dir"; transcodePath = mkOpt types.str "" "Path to the data dir"; puid = mkOpt types.str "911" "uid"; pgid = mkOpt types.str "1000" "gid"; timeZone = mkOpt types.str "America/Chicago" "Timezone"; reverseProxy = mkReverseProxyOpt; }; config = mkIf cfg.enable { virtualisation.oci-containers.containers.${cfg.name} = { autoStart = true; image = cfg.image; extraOptions = [ "--device=/dev/dri" ]; volumes = [ "${cfg.configPath}:/config" "${cfg.moviesPath}:/library/movies" "${cfg.tvPath}:/library/tv" "${cfg.transcodePath}:/tmp/unmanic" ]; ports = [ "${toString cfg.port}:8888" ]; environment = { PUID = cfg.puid; PGID = cfg.pgid; TZ = cfg.timeZone; }; }; }; }