about summary refs log tree commit diff
path: root/modules/piracy/jackett.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-01-06 23:21:56 +0300
committerazahi <azat@bahawi.net>2025-01-06 23:21:56 +0300
commit9faff5e0bee5718a5825cef2604a4e81ddcbd0e0 (patch)
treef2791f036b339e7c04958e6c0a1ca7604b9523f9 /modules/piracy/jackett.nix
parent2025-01-01 (diff)
2025-01-06 HEAD master
Diffstat (limited to 'modules/piracy/jackett.nix')
-rw-r--r--modules/piracy/jackett.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/modules/piracy/jackett.nix b/modules/piracy/jackett.nix
new file mode 100644
index 0000000..7ef9311
--- /dev/null
+++ b/modules/piracy/jackett.nix
@@ -0,0 +1,46 @@
+{
+  config,
+  inputs,
+  lib,
+  libNginx,
+  this,
+  ...
+}:
+let
+  cfg = config.nixfiles.modules.piracy.jackett;
+in
+{
+  options.nixfiles.modules.piracy.jackett = {
+    enable = lib.mkEnableOption "Jackett";
+
+    domain = lib.mkOption {
+      description = "Domain name sans protocol scheme.";
+      type = lib.types.str;
+      default = "jackett.${config.networking.domain}";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    ark.directories = [ "/var/lib/jackett" ];
+
+    nixfiles.modules.nginx = {
+      enable = true;
+      upstreams.jackett.servers."127.0.0.1:9117" = { };
+      virtualHosts.${cfg.domain} = {
+        locations."/".proxyPass = "http://jackett";
+        extraConfig = libNginx.config.internalOnly;
+      };
+    };
+
+    services.jackett.enable = true;
+
+    topology = with cfg; {
+      nodes.${this.hostname}.services.jackett = {
+        name = "Jackett";
+        icon = "${inputs.homelab-svg-assets}/assets/jackett.svg";
+        info = domain;
+        details.listen.text = "127.0.0.1:9117";
+      };
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3