2021-01-31 22:31:04 +01:00
|
|
|
# A FLOSS media server
|
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.jellyfin;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.jellyfin = {
|
|
|
|
enable = lib.mkEnableOption "Jellyfin Media Server";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.jellyfin = {
|
|
|
|
enable = true;
|
|
|
|
group = "media";
|
|
|
|
};
|
|
|
|
|
2021-09-15 15:57:23 +02:00
|
|
|
# Set-up media group
|
|
|
|
users.groups.media = { };
|
|
|
|
|
2023-12-26 15:17:03 +01:00
|
|
|
systemd.services.jellyfin = {
|
|
|
|
serviceConfig = {
|
|
|
|
# Loose umask to make Jellyfin metadata more broadly readable
|
|
|
|
UMask = lib.mkForce "0002";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-12-25 19:25:08 +01:00
|
|
|
my.services.nginx.virtualHosts = {
|
|
|
|
jellyfin = {
|
2021-08-24 23:05:10 +02:00
|
|
|
port = 8096;
|
|
|
|
extraConfig = {
|
|
|
|
locations."/" = {
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# Too bad for the repetition...
|
|
|
|
locations."/socket" = {
|
|
|
|
proxyPass = "http://127.0.0.1:8096/";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
2023-12-25 19:25:08 +01:00
|
|
|
};
|
|
|
|
};
|
2021-11-05 15:11:05 +01:00
|
|
|
|
|
|
|
my.system.persist.directories = [
|
|
|
|
"/var/lib/${config.systemd.services.jellyfin.serviceConfig.StateDirectory}"
|
|
|
|
];
|
2021-01-31 22:31:04 +01:00
|
|
|
};
|
|
|
|
}
|