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;
|
2024-11-19 16:49:31 +01:00
|
|
|
websocketsLocations = [ "/socket" ];
|
2021-08-24 23:05:10 +02:00
|
|
|
extraConfig = {
|
|
|
|
locations."/" = {
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-12-25 19:25:08 +01:00
|
|
|
};
|
|
|
|
};
|
2024-09-20 16:39:53 +02:00
|
|
|
|
|
|
|
services.fail2ban.jails = {
|
|
|
|
jellyfin = ''
|
|
|
|
enabled = true
|
|
|
|
filter = jellyfin
|
|
|
|
port = http,https
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.etc = {
|
|
|
|
"fail2ban/filter.d/jellyfin.conf".text = ''
|
|
|
|
[Definition]
|
|
|
|
failregex = ^.*Authentication request for .* has been denied \(IP: "?<ADDR>"?\)\.
|
|
|
|
journalmatch = _SYSTEMD_UNIT=jellyfin.service
|
|
|
|
'';
|
|
|
|
};
|
2021-01-31 22:31:04 +01:00
|
|
|
};
|
|
|
|
}
|