NixOS/system/podman/servarr/prowlarr.nix

66 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2024-06-25 23:21:17 +07:00
{ config, lib, ... }:
let
podman = config.profile.podman;
prowlarr = podman.servarr.prowlarr;
name = "prowlarr";
name-flaresolverr = "${name}-flaresolverr";
ip = "10.88.2.4";
ip-flaresolverr = "10.88.2.5";
image = "lscr.io/linuxserver/prowlarr:latest";
image-flaresolverr = "ghcr.io/flaresolverr/flaresolverr:latest";
root = "/nas/mediaserver/servarr";
configVolume = "${root}/prowlarr";
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 && prowlarr.enable) {
services.caddy.virtualHosts.${domain}.extraConfig = ''
reverse_proxy ${ip}:9696
'';
system.activationScripts."podman-${name}" = ''
mkdir -p ${configVolume}
chown ${uid}:${gid} ${configVolume}
'';
virtualisation.oci-containers.containers.${name-flaresolverr} = {
image = image-flaresolverr;
hostname = name-flaresolverr;
autoStart = true;
environment = {
TZ = "Asia/Jakarta";
};
extraOptions = [
"--ip=${ip-flaresolverr}"
"--network=podman"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
virtualisation.oci-containers.containers.${name} = {
inherit image;
hostname = name;
autoStart = true;
environment = {
PUID = uid;
PGID = gid;
TZ = "Asia/Jakarta";
};
volumes = [ "${configVolume}:/config" ];
2024-06-25 23:21:17 +07:00
extraOptions = [
"--ip=${ip}"
"--network=podman"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
};
}