# Jellyfin on r5500. Local libraries: /mnt/media-stack/jellyfin/{movies,tv}.
# Bulk libraries: /mnt/nixdesk-jellyfin/{movies,tv} (NFS from 14900k).
{ lib, ... }:
{
  nixpkgs.overlays = [
    (final: prev: {
      jellyfin-web = prev.jellyfin-web.overrideAttrs (oldAttrs: {
        postInstall =
          (oldAttrs.postInstall or "")
          + ''
            find "$out" -type f \( -name 'banner-light.*.png' -o -name 'banner-dark.*.png' \) \
              -exec truncate -s 0 {} \;
          '';
      });
    })
  ];

  users.users.jellyfin.extraGroups = [ "media" ];

  services.jellyfin = {
    enable = true;
    openFirewall = true;
  };

  systemd.services.jellyfin.serviceConfig = {
    SupplementaryGroups = [ "media" ];
    PrivateUsers = lib.mkForce false;
  };
}
