nixos/modules/services/sonarr/default.nix

64 lines
1.3 KiB
Nix
Raw Normal View History

2023-03-15 22:34:36 +01:00
# manages and downloads series
2023-11-07 22:00:00 +01:00
{ config, lib, ... }:
2023-03-15 22:34:36 +01:00
let
cfg = config.my.services.sonarr;
2023-11-07 23:13:51 +01:00
inherit (config.networking) domain;
2023-03-15 22:34:36 +01:00
port = 8989;
in
{
options.my.services.sonarr = with lib; {
enable = mkEnableOption "Sonarr for series 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:34:36 +01:00
};
config = lib.mkIf cfg.enable {
services.sonarr = {
enable = true;
};
systemd.services.sonarr = {
after = [ "network-online.target" ];
};
my.services.nginx.virtualHosts = [
{
subdomain = "series";
inherit port;
}
];
2023-07-22 16:05:28 +02:00
my.services.exportarr.sonarr = {
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 = "sonarr";
static_configs = [{
targets = [ "127.0.0.1:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};
}];
}
];
2023-03-15 22:34:36 +01:00
webapps.apps.sonarr = {
dashboard = {
2023-04-02 17:50:15 +02:00
name = "Series";
2023-04-02 17:43:28 +02:00
category = "media";
2023-03-15 22:34:36 +01:00
icon = "tv";
2023-11-12 20:39:44 +01:00
url = "https://series.${domain}";
2023-03-15 22:34:36 +01:00
};
};
};
}