From 8d48aa19f45d621d0ce234c81d3c930cb5b05eb5 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Thu, 4 May 2023 01:04:59 +0300 Subject: 2023-05-04 --- modules/nixos/jackett.nix | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/nixos/jackett.nix (limited to 'modules/nixos/jackett.nix') 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; + }; +} -- cgit 1.4.1