servarr: added recyclar but disabled because of how advanced it is

This commit is contained in:
Tigor Hutasuhut 2024-06-26 14:59:47 +07:00
parent 92cb15265c
commit 1eb35f34a1
4 changed files with 107 additions and 0 deletions

View file

@ -39,6 +39,10 @@ in
type = types.bool;
default = config.profile.podman.servarr.enable;
};
recyclarr.enable = mkOption {
type = types.bool;
default = config.profile.podman.servarr.enable;
};
};
};
}

View file

@ -32,6 +32,7 @@
redmage-demo.enable = true;
qbittorrent.enable = true;
servarr.enable = true;
servarr.recyclarr.enable = false;
};
docker = {

25
secrets/servarr.yaml Normal file
View file

@ -0,0 +1,25 @@
servarr:
api_keys:
sonarr: ENC[AES256_GCM,data:nm0L0hVqehTiwqx5JScyRHdw4P3vqI4GUARzdDR1lxI=,iv:UE2f2tB/a6QRDEVOvJntE+J2bJ0xLLVvS6XvNz5WWLQ=,tag:jsKFuKYmHotslk53rm1poA==,type:str]
sonarr-anime: ENC[AES256_GCM,data:9RqHLCZ+uwv9a4MTCrXdT0SYFmXBswskV1vpXqwVjAM=,iv:OregkJGVXKuS9hIopgPmbYSBfZKot1Z4FmenQvfqZS0=,tag:j0zjTJ6aDRejvmBtIK/dCA==,type:str]
radarr: ENC[AES256_GCM,data:8ZqFXPubFTdUuNC0Neb/GQrBiWCfFBcc+kLEhmr04vY=,iv:IiVw1I9ugCKklqK16kY0R0BCmGzeFwSi1Ra8mSk87zU=,tag:IrFnI2adhitmpZB1T+ntDw==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1kruum2varzua7w5n6n52vhwyek2arc685rhcwt0u7k2jf5mecsjslkl9ll
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBvcjY3WTZGRUFKWm5BcGR2
dWJ2TVZSY1phcitycnpDbG81UDg2M3dXbVJ3ClhlaG0rc1pNZWt6OXNWbEVaaUZu
S0xHSWlkVzBPdVFXZGJzZXF5RmpiZkEKLS0tIFovUS9kVXRzUlZYU2NyRXZYb1Zj
Sy91VlVMaTlGOW05bWRnMWo5Zm9FdkEK62c/Q2sBqL/m5FwBTglbHYVsN9X+iCvM
qtSsp6dVasPz//eXR7jIvvdwls/Sz64b2Ty8UIUEZCT/kI8E2/j0MQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-06-26T07:20:32Z"
mac: ENC[AES256_GCM,data:1hTsxSMKPQYToJMgDuLBffer8T/Uh8rw5y4uHk72BqpnCmrm2pVVQb2S3Pq+Fw2icw0BdmYmNTolA1651B4NT/6v6Z4mM10gu4BYlpeNWzPxRpVV52cLc+zD2acBvFxSvqOxPL+6lfAFRJHaUi2Wn0RKzt94RKNdgrRmhIYYDW4=,iv:oioh+NI8OMeeTEF0xLte4zkYwv26AlFj1IOYVoFfdAg=,tag:FwKFlcCoAd4d5yStJ4P5Xg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View file

@ -0,0 +1,77 @@
{ config, lib, pkgs, ... }:
let
podman = config.profile.podman;
name = "recyclarr";
recyclarr = podman.servarr.${name};
ip = "10.88.2.100";
image = "ghcr.io/recyclarr/recyclarr:latest";
root = "/nas/mediaserver/servarr";
configVolume = "${root}/${name}";
user = config.profile.user;
uid = toString user.uid;
gid = toString user.gid;
inherit (lib) mkIf;
in
{
config = mkIf (podman.enable && recyclarr.enable) {
system.activationScripts."podman-${name}" = ''
mkdir -p ${configVolume}
chown ${uid}:${gid} ${configVolume}
'';
sops.secrets =
let
opts = { sopsFile = ../../../secrets/servarr.yaml; };
in
{
"servarr/api_keys/sonarr" = opts;
"servarr/api_keys/sonarr-anime" = opts;
"servarr/api_keys/radarr" = opts;
};
sops.templates."recyclarr/recylarr.yml" = {
owner = user.name;
path = "${configVolume}/recyclarr.yml";
content = builtins.readFile ((pkgs.formats.yaml { }).generate "recyclarr.yml" {
sonarr = {
tv = {
base_url = "http://sonarr:8989";
api_key = config.sops.placeholders."servarr/api_keys/sonarr";
quality_definition.type = "series";
release_profiles = [
{
trash_ids = [ ];
}
];
};
anime = {
base_url = "http://sonarr-anime:8989";
api_key = config.sops.placeholders."servarr/api_keys/sonarr-anime";
quality_definition.type = "anime";
};
};
});
};
virtualisation.oci-containers.containers.${name} = {
inherit image;
hostname = name;
autoStart = true;
user = "${uid}:${gid}";
environment = {
TZ = "Asia/Jakarta";
};
volumes = [
"${configVolume}:/config"
];
extraOptions = [
"--ip=${ip}"
"--network=podman"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
};
}