mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2026-01-03 06:29:54 +01:00
treewide: Group media services in modules/services/media
This commit is contained in:
parent
e9951968c7
commit
b494b01a9c
11 changed files with 15 additions and 9 deletions
62
modules/services/media/bazarr/default.nix
Normal file
62
modules/services/media/bazarr/default.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# manages and downloads subtitles
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.bazarr;
|
||||
inherit (config.networking) domain;
|
||||
port = config.services.bazarr.listenPort;
|
||||
in
|
||||
{
|
||||
options.my.services.bazarr = {
|
||||
enable = lib.mkEnableOption "Bazarr for subtitle management";
|
||||
|
||||
apiKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
File containing the api-key.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
bazarr = {
|
||||
enable = true;
|
||||
};
|
||||
prometheus.exporters.exportarr-bazarr = {
|
||||
inherit (config.services.prometheus) enable;
|
||||
port = port + 1;
|
||||
url = "http://localhost:${toString port}";
|
||||
inherit (cfg) apiKeyFile;
|
||||
};
|
||||
prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "bazarr";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "localhost:${toString port + 1}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
my.services.webserver.virtualHosts = [
|
||||
{
|
||||
subdomain = "subtitles";
|
||||
inherit port;
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.bazarr = {
|
||||
dashboard = {
|
||||
name = "Subtitles";
|
||||
category = "app";
|
||||
icon = "closed-captioning";
|
||||
url = "https://subtitles.${domain}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue