1 { config, lib, pkgs, options, type, ... }:
4 cfg = config.services.prometheus.exporters."exportarr-${type}";
5 exportarrEnvironment = (
6 lib.mapAttrs (_: toString) cfg.environment
8 PORT = toString cfg.port;
10 API_KEY_FILE = lib.mkIf (cfg.apiKeyFile != null) "%d/api-key";
18 default = "http://127.0.0.1";
20 The full URL to Sonarr, Radarr, or Lidarr.
24 apiKeyFile = lib.mkOption {
25 type = lib.types.nullOr lib.types.path;
28 File containing the api-key.
32 package = lib.mkPackageOption pkgs "exportarr" { };
34 environment = lib.mkOption {
35 type = lib.types.attrsOf lib.types.str;
38 See [the configuration guide](https://github.com/onedr0p/exportarr#configuration) for available options.
41 PROWLARR__BACKFILL = true;
47 LoadCredential = lib.optionalString (cfg.apiKeyFile != null) "api-key:${cfg.apiKeyFile}";
48 ExecStart = ''${cfg.package}/bin/exportarr ${type} "$@"'';
50 ProtectProc = "invisible";
51 SystemCallFilter = ["@system-service" "~@privileged"];
53 environment = exportarrEnvironment;