{ config, pkgs, ... }:
{
  users.users.jellyfin.extraGroups = [ "media" "render" ];
  services.jellyfin = {
    enable = true;
    dataDir = "/var/lib/jellyfin";
  };

  services.caddy.virtualHosts."jelly.danielk.me" = {
    extraConfig = ''
      reverse_proxy 127.0.0.1:8096
    '';
  };

  systemd.tmpfiles.rules = [
    # not needed I think
    # "d /var/lib/jellyfin 0750 jellyfin jellyfin -"
    "d /var/lib/data/media 0770 daniel media -"
  ];
  
  environment.systemPackages = with pkgs; [
    jellyfin
    jellyfin-web
    jellyfin-ffmpeg
  ];

  hardware.graphics = {
    enable = true;
    extraPackages = with pkgs; [
      intel-media-driver
      intel-compute-runtime
      intel-vaapi-driver
      libva-vdpau-driver
      libva
      libvdpau-va-gl
    ];
  };
}
