nixos/modules/services/jellyfin/default.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

2022-11-29 18:47:27 +01:00
# The Free Software Media System
{ config, lib, pkgs, ... }:
let
cfg = config.my.services.jellyfin;
domain = config.networking.domain;
port = 8096;
2023-06-03 22:42:21 +02:00
# enable monitoring
jellyfin-with-metrics = pkgs.jellyfin.overrideAttrs (attrs: {
# with this patch the default setting for metrics is changed
patches = attrs.patches ++ [ ./enable-metrics.patch ];
});
2022-11-29 18:47:27 +01:00
in
{
options.my.services.jellyfin = with lib; {
enable = mkEnableOption "Jellyfin Media Server";
};
config = lib.mkIf cfg.enable {
services.jellyfin = {
enable = true;
2023-06-03 22:42:21 +02:00
package = jellyfin-with-metrics;
2022-11-29 18:47:27 +01:00
};
2023-06-03 22:42:21 +02:00
services.prometheus = {
scrapeConfigs = [
{
job_name = "jellyfin";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};
}
];
}
];
};
# sadly the metrics do not contain application specific metrics, only c# -> no dashboard
2022-11-29 18:47:27 +01:00
my.services.nginx.virtualHosts = [
{
2023-04-02 15:54:01 +02:00
subdomain = "media";
2022-11-29 18:47:27 +01:00
inherit port;
}
];
webapps.apps.jellyfin = {
dashboard = {
2023-04-02 15:54:01 +02:00
name = "Media";
2022-11-29 18:47:27 +01:00
category = "media";
icon = "film";
2023-04-02 15:54:01 +02:00
link = "https://media.${domain}";
2022-11-29 18:47:27 +01:00
};
};
};
}