From 59180328cda59817d71cd58c8f48ead047375064 Mon Sep 17 00:00:00 2001 From: azahi Date: Mon, 17 Feb 2025 02:21:56 +0300 Subject: 2025-02-17 --- modules/piracy/prowlarr.nix | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 modules/piracy/prowlarr.nix (limited to 'modules/piracy/prowlarr.nix') diff --git a/modules/piracy/prowlarr.nix b/modules/piracy/prowlarr.nix new file mode 100644 index 0000000..ebcba7f --- /dev/null +++ b/modules/piracy/prowlarr.nix @@ -0,0 +1,62 @@ +{ + config, + inputs, + lib, + libNginx, + this, + ... +}: +let + cfg = config.nixfiles.modules.piracy.prowlarr; + + port = 9696; +in +{ + options.nixfiles.modules.piracy.prowlarr = { + enable = lib.mkEnableOption "Prowlarr"; + + domain = lib.mkOption { + description = "Domain name sans protocol scheme."; + type = lib.types.str; + default = "prowlarr.${config.networking.domain}"; + }; + }; + + config = lib.mkIf cfg.enable { + # secrets.prowlarr-api-key.file = "${inputs.self}/secrets/prowlarr-api-key"; + + ark.directories = [ "/var/lib/private/prowlarr" ]; + + nixfiles.modules.nginx = { + enable = true; + upstreams.prowlarr.servers."127.0.0.1:${toString port}" = { }; + virtualHosts.${cfg.domain} = { + locations."/".proxyPass = "http://prowlarr"; + extraConfig = libNginx.config.internalOnly; + }; + }; + + services = { + prowlarr.enable = true; + + prometheus.exporters.exportarr-prowlarr = { + enable = true; + url = "http://127.0.0.1"; + port = port + 10000; + apiKeyFile = config.secrets.lidarr-api-key.path; + listenAddress = this.wireguard.ipv4.address; + environment = { + PROWLARR__BACKFILL = "true"; + PROWLARR__BACKFILL_DATE_SINCE = "2025-01-01"; + }; + }; + }; + + topology.nodes.${this.hostname}.services.prowlarr = { + name = "Prowlarr"; + icon = "${inputs.homelab-svg-assets}/assets/prowlarr.svg"; + info = cfg.domain; + details.listen.text = "127.0.0.1:${toString port}"; + }; + }; +} -- cgit 1.4.1