{ config, inputs, lib, libNginx, this, ... }: 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; 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"; }; }; }; }