blob: ac2fe7f479aefc77b7ca714e54d13dc5ec2da0f7 (
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
78
79
80
81
82
83
84
|
{
config,
inputs,
lib,
libNginx,
this,
...
}:
with lib;
let
cfg = config.nixfiles.modules.piracy.radarr;
port = 7878;
in
{
options.nixfiles.modules.piracy.radarr = {
enable = mkEnableOption "Radarr";
domain = mkOption {
description = "Domain name sans protocol scheme.";
type = with types; str;
default = "radarr.${config.networking.domain}";
};
};
config = mkIf cfg.enable {
secrets.radarr-api-key.file = "${inputs.self}/secrets/radarr-api-key";
ark.directories = [ "/var/lib/radarr" ];
nixfiles.modules = {
nginx = {
enable = true;
upstreams.radarr.servers."127.0.0.1:${toString port}" = { };
virtualHosts.${cfg.domain} = {
locations."/".proxyPass = "http://radarr";
extraConfig = libNginx.config.internalOnly;
};
};
piracy = {
enable = true;
jackett.enable = true;
};
};
services = {
radarr = {
enable = true;
group = "piracy";
};
prometheus.exporters.exportarr-radarr = {
enable = true;
url = "http://127.0.0.1";
port = port + 10000;
apiKeyFile = config.secrets.radarr-api-key.path;
inherit (config.services.radarr) user;
inherit (config.services.radarr) group;
listenAddress = this.wireguard.ipv4.address;
environment.CONFIG = "/var/lib/radarr/.config/Radarr/config.xml";
};
};
systemd = {
tmpfiles.rules = with config.services.radarr; [
"d /var/lib/radarr/root 0755 ${user} ${group} - -"
];
services.lidarr.after = [
"flood.service"
"jackett.service"
"local-fs.target"
];
};
topology = with cfg; {
nodes.${this.hostname}.services.radarr = {
info = domain;
details.listen.text = "127.0.0.1:${toString port}";
};
};
};
}
|