about summary refs log tree commit diff
path: root/modules/nixos/lidarr.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-13 10:40:41 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-13 10:40:41 +0300
commita3f9fde2a2d43dd477f402bd4b8df2a1cd29ca43 (patch)
treecbd0c2457daa6865eb33b5389ec40309e60868a9 /modules/nixos/lidarr.nix
parent2023-11-12 (diff)
2023-11-13
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