2023-11-08 21:27:47 +01:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
anyOpt = default: lib.mkOption {
|
|
|
|
type = lib.types.anything;
|
|
|
|
inherit default;
|
|
|
|
};
|
|
|
|
|
|
|
|
testConfig = m:
|
|
|
|
let
|
|
|
|
cfg = (lib.evalModules {
|
|
|
|
specialArgs = { inherit pkgs; };
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
systemd = anyOpt {};
|
|
|
|
shb.backup = anyOpt {};
|
|
|
|
shb.nginx = anyOpt {};
|
|
|
|
users = anyOpt {};
|
|
|
|
services.bazarr = anyOpt {};
|
|
|
|
services.jackett = anyOpt {};
|
|
|
|
services.lidarr = anyOpt {};
|
|
|
|
services.radarr = anyOpt {};
|
|
|
|
services.readarr = anyOpt {};
|
|
|
|
services.sonarr = anyOpt {};
|
|
|
|
};
|
|
|
|
}
|
2023-11-21 07:20:19 +01:00
|
|
|
../../modules/services/arr.nix
|
2023-11-08 21:27:47 +01:00
|
|
|
m
|
|
|
|
];
|
|
|
|
}).config;
|
2023-12-04 06:42:09 +01:00
|
|
|
|
|
|
|
systemdRedacted = lib.filterAttrsRecursive (n: v: n != "preStart") cfg.systemd;
|
2023-11-08 21:27:47 +01:00
|
|
|
in {
|
2023-12-04 06:42:09 +01:00
|
|
|
inherit (cfg) services users;
|
|
|
|
systemd = systemdRedacted;
|
2023-11-08 21:27:47 +01:00
|
|
|
shb = { inherit (cfg.shb) backup nginx; };
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
testArrNoOptions = {
|
|
|
|
expected = {
|
2023-11-17 08:00:53 +01:00
|
|
|
systemd.services.radarr = {};
|
2023-11-08 21:27:47 +01:00
|
|
|
systemd.services.jackett = {};
|
|
|
|
shb.backup = {};
|
|
|
|
shb.nginx.autheliaProtect = [];
|
|
|
|
users.users = {};
|
|
|
|
services.bazarr = {};
|
|
|
|
services.jackett = {};
|
|
|
|
services.lidarr = {};
|
|
|
|
services.radarr = {};
|
|
|
|
services.readarr = {};
|
|
|
|
services.sonarr = {};
|
|
|
|
};
|
|
|
|
expr = testConfig {};
|
|
|
|
};
|
2023-11-17 08:48:19 +01:00
|
|
|
|
|
|
|
testRadarr = {
|
|
|
|
expected = {
|
|
|
|
systemd.services.radarr = {
|
|
|
|
serviceConfig = {
|
|
|
|
StateDirectoryMode = "0750";
|
|
|
|
UMask = "0027";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemd.services.jackett = {};
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '/var/lib/radarr' 0750 radarr radarr - -"
|
|
|
|
];
|
|
|
|
shb.backup = {};
|
|
|
|
shb.nginx.autheliaProtect = [
|
|
|
|
{
|
|
|
|
autheliaRules = [
|
|
|
|
{
|
|
|
|
domain = "radarr.example.com";
|
|
|
|
policy = "bypass";
|
|
|
|
resources = [
|
|
|
|
"^/api.*"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
domain = "radarr.example.com";
|
|
|
|
policy = "two_factor";
|
|
|
|
subject = [
|
|
|
|
"group:arr_user"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
domain = "example.com";
|
2023-11-30 21:48:57 +01:00
|
|
|
authEndpoint = "https://oidc.example.com";
|
2023-11-17 08:48:19 +01:00
|
|
|
subdomain = "radarr";
|
|
|
|
upstream = "http://127.0.0.1:7001";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
users.users.radarr.extraGroups = [ "media" ];
|
|
|
|
users.groups.radarr.members = [ "backup" ];
|
|
|
|
services.bazarr = {};
|
|
|
|
services.jackett = {};
|
|
|
|
services.lidarr = {};
|
|
|
|
services.radarr = {
|
|
|
|
enable = true;
|
|
|
|
dataDir = "/var/lib/radarr";
|
|
|
|
user = "radarr";
|
|
|
|
group = "radarr";
|
|
|
|
};
|
|
|
|
services.readarr = {};
|
|
|
|
services.sonarr = {};
|
|
|
|
};
|
|
|
|
expr = testConfig {
|
|
|
|
services.radarr.user = "radarr";
|
|
|
|
services.radarr.group = "radarr";
|
|
|
|
|
|
|
|
shb.arr.radarr = {
|
|
|
|
subdomain = "radarr";
|
|
|
|
domain = "example.com";
|
|
|
|
enable = true;
|
2023-11-30 21:48:57 +01:00
|
|
|
authEndpoint = "https://oidc.example.com";
|
2023-11-17 08:48:19 +01:00
|
|
|
settings = {
|
|
|
|
APIKeyFile = "/run/radarr/apikey";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testRadarrWithBackup = {
|
|
|
|
expected = {
|
|
|
|
systemd.services.radarr = {
|
|
|
|
serviceConfig = {
|
|
|
|
StateDirectoryMode = "0750";
|
|
|
|
UMask = "0027";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemd.services.jackett = {};
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '/var/lib/radarr' 0750 radarr radarr - -"
|
|
|
|
];
|
|
|
|
shb.backup.instances = {
|
|
|
|
radarr = {
|
|
|
|
enable = true;
|
|
|
|
sourceDirectories = [ "/var/lib/radarr" ];
|
|
|
|
excludePatterns = [ ".db-shm" ".db-wal" ".mono" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
shb.nginx.autheliaProtect = [
|
|
|
|
{
|
|
|
|
autheliaRules = [
|
|
|
|
{
|
|
|
|
domain = "radarr.example.com";
|
|
|
|
policy = "bypass";
|
|
|
|
resources = [
|
|
|
|
"^/api.*"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
domain = "radarr.example.com";
|
|
|
|
policy = "two_factor";
|
|
|
|
subject = [
|
|
|
|
"group:arr_user"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
domain = "example.com";
|
2023-11-30 21:48:57 +01:00
|
|
|
authEndpoint = "https://oidc.example.com";
|
2023-11-17 08:48:19 +01:00
|
|
|
subdomain = "radarr";
|
|
|
|
upstream = "http://127.0.0.1:7001";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
users.users.radarr.extraGroups = [ "media" ];
|
|
|
|
users.groups.radarr.members = [ "backup" ];
|
|
|
|
services.bazarr = {};
|
|
|
|
services.jackett = {};
|
|
|
|
services.lidarr = {};
|
|
|
|
services.radarr = {
|
|
|
|
enable = true;
|
|
|
|
dataDir = "/var/lib/radarr";
|
|
|
|
user = "radarr";
|
|
|
|
group = "radarr";
|
|
|
|
};
|
|
|
|
services.readarr = {};
|
|
|
|
services.sonarr = {};
|
|
|
|
};
|
|
|
|
expr = testConfig {
|
|
|
|
services.radarr.user = "radarr";
|
|
|
|
services.radarr.group = "radarr";
|
|
|
|
|
|
|
|
shb.arr.radarr = {
|
|
|
|
subdomain = "radarr";
|
|
|
|
domain = "example.com";
|
|
|
|
enable = true;
|
2023-11-30 21:48:57 +01:00
|
|
|
authEndpoint = "https://oidc.example.com";
|
2023-11-17 08:48:19 +01:00
|
|
|
settings = {
|
|
|
|
APIKeyFile = "/run/radarr/apikey";
|
|
|
|
};
|
|
|
|
backupCfg = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-11-08 21:27:47 +01:00
|
|
|
}
|