NixOS/system/podman/servarr/bazarr.nix

58 lines
1.4 KiB
Nix
Raw Normal View History

2024-06-26 00:37:07 +07:00
{ config, lib, ... }:
let
podman = config.profile.podman;
bazarr = podman.servarr.bazarr;
name = "bazarr";
ip = "10.88.2.6";
image = "lscr.io/linuxserver/${name}:latest";
root = "/nas/mediaserver/servarr";
configVolume = "${root}/${name}";
mediaVolume = "${root}/data";
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 && bazarr.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}:6767";
2024-11-24 21:49:24 +07:00
proxyWebsockets = true;
2024-11-24 20:16:30 +07:00
};
};
security.acme.certs."tigor.web.id".extraDomainNames = [ domain ];
2024-06-26 00:37:07 +07:00
system.activationScripts."podman-${name}" = ''
mkdir -p ${configVolume}
chown ${uid}:${gid} ${mediaVolume} ${configVolume}
'';
virtualisation.oci-containers.containers.${name} = {
inherit image;
hostname = name;
autoStart = true;
environment = {
PUID = uid;
PGID = gid;
TZ = "Asia/Jakarta";
};
volumes = [
"${configVolume}:/config"
"${mediaVolume}:/data"
];
extraOptions = [
"--ip=${ip}"
"--network=podman"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
};
}