summaryrefslogtreecommitdiff
path: root/modules/jackett.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
committerAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
commite6ed60548397627bf10f561f9438201dbba0a36e (patch)
treef9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/jackett.nix
parent9ac64328603d44bd272175942d3ea3eaadcabd04 (diff)
2024-04-21
Diffstat (limited to 'modules/jackett.nix')
-rw-r--r--modules/jackett.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/jackett.nix b/modules/jackett.nix
new file mode 100644
index 0000000..492e77a
--- /dev/null
+++ b/modules/jackett.nix
@@ -0,0 +1,36 @@
+{
+ config,
+ lib,
+ libNginx,
+ ...
+}:
+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 = libNginx.config.internalOnly;
+ };
+ };
+
+ services.jackett.enable = true;
+ };
+}