diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-05-04 01:04:59 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-05-04 01:04:59 +0300 |
commit | 8d48aa19f45d621d0ce234c81d3c930cb5b05eb5 (patch) | |
tree | 0ea1ba56b8e31eca1316400e4b16f2602c970327 /modules/nixos/jackett.nix | |
parent | 2023-05-02 (diff) |
2023-05-04
Diffstat (limited to 'modules/nixos/jackett.nix')
-rw-r--r-- | modules/nixos/jackett.nix | 33 |
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; + }; +} |