{ config, lib, pkgs, ... }:
{
  # Enable Hardware Acceleration for transcoding
  nixpkgs.config.packageOverrides = pkgs: {
    vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
  };
  hardware.opengl = {
    enable = true;
    extraPackages = with pkgs; [
      intel-media-driver
      vaapiIntel
      vaapiVdpau
      libvdpau-va-gl
      intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
    ];
  };
  services.jellyfin = {
    enable = true;
    user = "jellyfin";
    group = "video";
    openFirewall = true; # only for defaults
  };
  networking.firewall.allowedTCPPorts = [ 8181 ];
  users.users.jellyfin = {
    extraGroups = [ "video" "audio" ];
  };
}
