about summary refs log tree commit diff
path: root/modules/nixos/lidarr.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/lidarr.nix24
1 files changed, 20 insertions, 4 deletions
diff --git a/modules/nixos/lidarr.nix b/modules/nixos/lidarr.nix
index b0c833c..9b166cf 100644
--- a/modules/nixos/lidarr.nix
+++ b/modules/nixos/lidarr.nix
@@ -1,5 +1,6 @@
 {
   config,
+  inputs,
   lib,
   libNginx,
   ...
@@ -18,6 +19,8 @@ in {
   };
 
   config = mkIf cfg.enable {
+    secrets.lidarr-api-key.file = "${inputs.self}/secrets/lidarr-api-key";
+
     ark.directories = ["/var/lib/lidarr"];
 
     nixfiles.modules.nginx = {
@@ -29,10 +32,23 @@ in {
       };
     };
 
-    services.lidarr = {
-      enable = true;
-      user = "rtorrent";
-      group = "rtorrent";
+    services = {
+      lidarr = {
+        enable = true;
+        user = "rtorrent";
+        group = "rtorrent";
+      };
+
+      prometheus.exporters.exportarr-lidarr = {
+        enable = true;
+        url = "http://127.0.0.1";
+        apiKeyFile = config.secrets.lidarr-api-key.path;
+        port = mkDefault 9708;
+        inherit (config.services.lidarr) user;
+        inherit (config.services.lidarr) group;
+        listenAddress = this.wireguard.ipv4.address;
+        environment.CONFIG = "/var/lib/lidarr/.config/Lidarr/config.xml";
+      };
     };
 
     systemd.tmpfiles.rules = with config.services.lidarr; [

Consider giving Nix/NixOS a try! <3