nixos/modules/services/bazarr/default.nix

61 lines
1.3 KiB
Nix
Raw Normal View History

2023-03-15 22:37:27 +01:00
# manages and downloads subtitles
2023-11-07 22:00:00 +01:00
{ config, lib, ... }:
2023-03-15 22:37:27 +01:00
let
cfg = config.my.services.bazarr;
2023-11-07 23:13:51 +01:00
inherit (config.networking) domain;
2023-03-15 22:37:27 +01:00
port = 6767;
in
{
options.my.services.bazarr = with lib; {
enable = mkEnableOption "Bazarr for subtitle management";
apiKeyFile = lib.mkOption {
type = lib.types.path;
description = lib.mdDoc ''
File containing the api-key.
'';
};
2023-03-15 22:37:27 +01:00
};
config = lib.mkIf cfg.enable {
services = {
bazarr = {
enable = true;
};
prometheus.exporters.exportarr-bazarr = {
inherit (config.services.prometheus) enable;
port = port + 1;
url = "http://127.0.0.1:${toString port}";
inherit (cfg) apiKeyFile;
};
prometheus.scrapeConfigs = [
{
job_name = "bazarr";
static_configs = [{
targets = [ "127.0.0.1:${toString port + 1}" ];
labels = {
instance = config.networking.hostName;
};
}];
}
];
2023-03-15 22:37:27 +01:00
};
my.services.nginx.virtualHosts = [
{
subdomain = "subtitles";
inherit port;
}
];
webapps.apps.bazarr = {
dashboard = {
name = "Subtitles";
2023-06-04 14:30:30 +02:00
category = "app";
2023-03-15 22:37:27 +01:00
icon = "closed-captioning";
2023-11-12 20:39:44 +01:00
url = "https://subtitles.${domain}";
2023-03-15 22:37:27 +01:00
};
};
};
}