nixos/modules/services/jellyfin/default.nix

67 lines
1.5 KiB
Nix
Raw Normal View History

2022-11-29 18:47:27 +01:00
# The Free Software Media System
2024-07-28 21:08:02 +02:00
{
config,
lib,
pkgs,
...
}:
2022-11-29 18:47:27 +01:00
let
cfg = config.my.services.jellyfin;
2023-11-07 23:13:51 +01:00
inherit (config.networking) domain;
2022-11-29 18:47:27 +01:00
port = 8096;
2023-06-03 22:42:21 +02:00
# enable monitoring
jellyfin-with-metrics = pkgs.jellyfin.overrideAttrs (attrs: {
patches =
let
2024-07-28 21:08:02 +02:00
existingPatches = if attrs ? patches && builtins.isList attrs.patches then attrs.patches else [ ];
in
# with this patch the default setting for metrics is changed
existingPatches ++ [ ./enable-metrics.patch ];
2023-06-03 22:42:21 +02:00
});
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 = [ "localhost:${toString cfg.port}" ];
2023-06-03 22:42:21 +02:00
labels = {
instance = config.networking.hostName;
};
}
];
}
];
};
# sadly the metrics do not contain application specific metrics, only c# -> no dashboard
my.services.webserver.virtualHosts = [
2022-11-29 18:47:27 +01:00
{
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";
2023-06-04 14:30:30 +02:00
icon = "eye";
2023-11-12 20:39:44 +01:00
url = "https://media.${domain}";
2022-11-29 18:47:27 +01:00
};
};
};
}