blob: c1c34cc617d3d76dce0b1e868ebdf4392c112176 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
{
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 = "127.0.0.1";
environment = {
PROWLARR__BACKFILL = "true";
PROWLARR__BACKFILL_DATE_SINCE = "2025-01-01";
};
};
};
environment.etc."alloy/prowlarr.alloy".text =
with config.services.prometheus.exporters.exportarr-prowlarr; ''
prometheus.scrape "prowlarr" {
targets = [
{
__address__ = "${listenAddress}:${toString port}",
instance = "${config.networking.hostName}",
}
]
forward_to = [prometheus.relabel.default.receiver]
}
'';
systemd.services.alloy.reloadTriggers = [ config.environment.etc."alloy/prowlarr.alloy".source ];
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}";
};
};
}
|