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
70
modules/services/media/sonarr/default.nix
Normal file
70
modules/services/media/sonarr/default.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# manages and downloads series
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.sonarr;
|
||||
inherit (config.networking) domain;
|
||||
port = 8989;
|
||||
in
|
||||
{
|
||||
options.my.services.sonarr = {
|
||||
enable = lib.mkEnableOption "Sonarr for series management";
|
||||
|
||||
apiKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
File containing the api-key.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# TODO: remove when sonarr is updated to 5.x
|
||||
nixpkgs.config.permittedInsecurePackages = [
|
||||
"dotnet-sdk-6.0.428"
|
||||
"aspnetcore-runtime-6.0.36"
|
||||
];
|
||||
|
||||
services = {
|
||||
sonarr = {
|
||||
enable = true;
|
||||
settings.server.port = port;
|
||||
};
|
||||
prometheus.exporters.exportarr-sonarr = {
|
||||
inherit (config.services.prometheus) enable;
|
||||
port = port + 1;
|
||||
url = "http://localhost:${toString port}";
|
||||
inherit (cfg) apiKeyFile;
|
||||
};
|
||||
prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "sonarr";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "localhost:${toString port + 1}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
my.services.webserver.virtualHosts = [
|
||||
{
|
||||
subdomain = "series";
|
||||
inherit port;
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.sonarr = {
|
||||
dashboard = {
|
||||
name = "Series";
|
||||
category = "media";
|
||||
icon = "tv";
|
||||
url = "https://series.${domain}";
|
||||
method = "get";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue