nixos/modules/services/radarr/default.nix

64 lines
1.3 KiB
Nix
Raw Normal View History

2023-03-15 22:35:46 +01:00
# manages and downloads films
2023-11-07 22:00:00 +01:00
{ config, lib, ... }:
2023-03-15 22:35:46 +01:00
let
cfg = config.my.services.radarr;
2023-11-07 23:13:51 +01:00
inherit (config.networking) domain;
2023-03-15 22:35:46 +01:00
port = 7878;
in
{
options.my.services.radarr = with lib; {
2023-10-16 23:05:03 +02:00
enable = mkEnableOption "Radarr for films management";
2023-07-25 22:20:49 +02:00
apiKeyFile = lib.mkOption {
type = lib.types.path;
description = lib.mdDoc ''
File containing the api-key.
'';
};
2023-03-15 22:35:46 +01:00
};
config = lib.mkIf cfg.enable {
services.radarr = {
enable = true;
};
systemd.services.radarr = {
after = [ "network-online.target" ];
};
my.services.nginx.virtualHosts = [
{
subdomain = "movies";
inherit port;
}
];
2023-07-22 16:05:28 +02:00
my.services.exportarr.radarr = {
port = port + 1;
url = "http://127.0.0.1:${toString port}";
2023-11-07 23:13:51 +01:00
inherit (cfg) apiKeyFile;
2023-07-22 16:05:28 +02:00
};
2023-07-25 22:20:49 +02:00
services.prometheus.scrapeConfigs = [
{
job_name = "radarr";
static_configs = [{
targets = [ "127.0.0.1:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};
}];
}
];
2023-03-15 22:35:46 +01:00
webapps.apps.radarr = {
dashboard = {
2023-04-02 17:50:15 +02:00
name = "Movies";
2023-04-02 17:43:28 +02:00
category = "media";
2023-03-15 22:35:46 +01:00
icon = "film";
link = "https://movies.${domain}";
};
};
};
}