about summary refs log tree commit diff
path: root/modules/nixos/jackett.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/jackett.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/nixos/jackett.nix b/modules/nixos/jackett.nix
new file mode 100644
index 0000000..f8e45ba
--- /dev/null
+++ b/modules/nixos/jackett.nix
@@ -0,0 +1,33 @@
+{
+  config,
+  lib,
+  ...
+}:
+with lib; let
+  cfg = config.nixfiles.modules.jackett;
+in {
+  options.nixfiles.modules.jackett = {
+    enable = mkEnableOption "Jackett";
+
+    domain = mkOption {
+      description = "Domain name sans protocol scheme.";
+      type = with types; str;
+      default = "jackett.${config.networking.domain}";
+    };
+  };
+
+  config = 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 = nginxInternalOnly;
+      };
+    };
+
+    services.jackett.enable = true;
+  };
+}

Consider giving Nix/NixOS a try! <3