mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
service/exportarr: fix apikey
This commit is contained in:
parent
724ca9dc1a
commit
e4d8129873
7 changed files with 97 additions and 13 deletions
|
@ -26,11 +26,6 @@ in
|
|||
}
|
||||
];
|
||||
|
||||
my.services.exportarr.bazarr = {
|
||||
port = port + 1;
|
||||
url = "http://127.0.0.1:${toString port}";
|
||||
};
|
||||
|
||||
webapps.apps.bazarr = {
|
||||
dashboard = {
|
||||
name = "Subtitles";
|
||||
|
|
|
@ -4,16 +4,17 @@ let
|
|||
|
||||
mkExportarrService = name: conf:
|
||||
let
|
||||
exportarrEnvironment = {
|
||||
exportarrEnvironment = (
|
||||
lib.mapAttrs (_: toString) conf.environment
|
||||
) // {
|
||||
PORT = toString conf.port;
|
||||
URL = conf.url;
|
||||
} // (
|
||||
lib.mapAttrs (_: toString) conf.environment
|
||||
);
|
||||
API_KEY_FILE = lib.mkIf (conf.apiKeyFile != null) "%d/api-key";
|
||||
};
|
||||
in
|
||||
lib.nameValuePair "exportarr-${name}" {
|
||||
description = "Exportarr Service ${name}";
|
||||
script = ''exec ${conf.package}/bin/exportarr "$@"'';
|
||||
script = ''exec ${conf.package}/bin/exportarr ${name} "$@"'';
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
User = "exportarr-${name}";
|
||||
|
@ -23,6 +24,9 @@ let
|
|||
WorkingDirectory = "/var/lib/exportarr-${name}";
|
||||
RuntimeDirectory = "exportarr-${name}";
|
||||
|
||||
LoadCredential = lib.optionalString (conf.apiKeyFile != null)
|
||||
"api-key:${conf.apiKeyFile}";
|
||||
|
||||
CapabilityBoundingSet = "";
|
||||
LockPersonality = true;
|
||||
PrivateDevices = true;
|
||||
|
@ -88,6 +92,14 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
apiKeyFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
File containing the api-key.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkPackageOptionMD pkgs "exportarr" { };
|
||||
|
||||
environment = lib.mkOption {
|
||||
|
@ -97,7 +109,6 @@ in
|
|||
See [the configuration guide](https://github.com/onedr0p/exportarr#configuration) for available options.
|
||||
'';
|
||||
example = {
|
||||
API_KEY_FILE = "/run/secrets/exportarr";
|
||||
PROWLARR__BACKFILL = true;
|
||||
};
|
||||
};
|
||||
|
@ -107,6 +118,12 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf (cfg != { }) {
|
||||
assertions = lib.mapAttrsToList
|
||||
(name: config: {
|
||||
assertion = builtins.elem name [ "sonarr" "radarr" "lidarr" "prowlarr" "readarr" "sabnzbd" ];
|
||||
message = "exportarr does not support this service.";
|
||||
})
|
||||
cfg;
|
||||
systemd.services = lib.mapAttrs' mkExportarrService cfg;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,6 +8,13 @@ in
|
|||
{
|
||||
options.my.services.prowlarr = with lib; {
|
||||
enable = mkEnableOption "Prowlarr for indexing";
|
||||
|
||||
apiKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = lib.mdDoc ''
|
||||
File containing the api-key.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -39,8 +46,21 @@ in
|
|||
my.services.exportarr.prowlarr = {
|
||||
port = port + 1;
|
||||
url = "http://127.0.0.1:${toString port}";
|
||||
apiKeyFile = cfg.apiKeyFile;
|
||||
};
|
||||
|
||||
services.prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "prowlarr";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString port + 1}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}];
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.prowlarr = {
|
||||
dashboard = {
|
||||
name = "Indexer";
|
||||
|
|
|
@ -8,6 +8,13 @@ in
|
|||
{
|
||||
options.my.services.radarr = with lib; {
|
||||
enable = mkEnableOption "Sonarr for films management";
|
||||
|
||||
apiKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = lib.mdDoc ''
|
||||
File containing the api-key.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -29,8 +36,21 @@ in
|
|||
my.services.exportarr.radarr = {
|
||||
port = port + 1;
|
||||
url = "http://127.0.0.1:${toString port}";
|
||||
apiKeyFile = cfg.apiKeyFile;
|
||||
};
|
||||
|
||||
services.prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "radarr";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString port + 1}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}];
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.radarr = {
|
||||
dashboard = {
|
||||
name = "Movies";
|
||||
|
|
|
@ -8,6 +8,13 @@ in
|
|||
{
|
||||
options.my.services.sonarr = with lib; {
|
||||
enable = mkEnableOption "Sonarr for series management";
|
||||
|
||||
apiKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = lib.mdDoc ''
|
||||
File containing the api-key.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -29,8 +36,21 @@ in
|
|||
my.services.exportarr.sonarr = {
|
||||
port = port + 1;
|
||||
url = "http://127.0.0.1:${toString port}";
|
||||
apiKeyFile = cfg.apiKeyFile;
|
||||
};
|
||||
|
||||
services.prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "sonarr";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString port + 1}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}];
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.sonarr = {
|
||||
dashboard = {
|
||||
name = "Series";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue