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

53 lines
1.4 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) {
services.caddy.virtualHosts.${domain}.extraConfig = ''
2024-06-25 22:45:00 +07:00
reverse_proxy ${ip}:5000
'';
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";
};
};
};
}