NixOS/system/podman/servarr/real-debrid-manager.nix

60 lines
1.6 KiB
Nix
Raw Normal View History

2024-06-25 22:45:00 +07:00
{ config, lib, ... }:
let
podman = config.profile.podman;
name = "real-debrid-manager";
2024-06-26 19:25:28 +07:00
real-debrid-manager = podman.servarr.${name};
ip = "10.88.2.99";
image = "docker.io/hyperbunny77/realdebridmanager:2022.06.27";
root = "/nas/mediaserver/servarr";
configVolume = "${root}/real-debrid-manager";
mediaVolume = "${root}/data/torrents";
watchVolume = "${mediaVolume}/watch";
domain = "${name}.tigor.web.id";
2024-06-25 22:45:00 +07:00
user = config.profile.user;
uid = toString user.uid;
gid = toString user.gid;
inherit (lib) mkIf;
in
{
2024-06-26 19:25:28 +07:00
config = mkIf (podman.enable && real-debrid-manager.enable) {
2024-11-24 20:16:30 +07:00
services.nginx.virtualHosts.${domain} = {
useACMEHost = "tigor.web.id";
2024-11-24 20:16:30 +07:00
forceSSL = true;
locations."/" = {
proxyPass = "http://${ip}:5000";
proxyWebsockets = true;
};
};
security.acme.certs."tigor.web.id".extraDomainNames = [ domain ];
2024-06-25 22:45:00 +07:00
system.activationScripts."podman-${name}" = ''
2024-06-26 19:25:28 +07:00
mkdir -p ${configVolume} ${mediaVolume} ${watchVolume}
chown ${uid}:${gid} ${configVolume} ${mediaVolume} ${watchVolume}
2024-06-25 22:45:00 +07:00
'';
virtualisation.oci-containers.containers.${name} = {
inherit image;
hostname = name;
autoStart = true;
user = "${uid}:${gid}";
2024-06-26 19:25:28 +07:00
environment = {
2024-06-25 22:45:00 +07:00
TZ = "Asia/Jakarta";
rdmport = "5000";
};
volumes = [
2024-06-26 19:25:28 +07:00
"${configVolume}:/config"
"${mediaVolume}:/data/torrents"
"${watchVolume}:/watch"
2024-06-25 22:45:00 +07:00
];
extraOptions = [
"--network=podman"
"--ip=${ip}"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
};
}