server-configuration/services/jellyfin.nix
2025-03-04 21:34:39 +01:00

59 lines
1.4 KiB
Nix

{
lib,
pkgs,
config,
...
}: let
host = "127.0.0.1";
port = 8096;
in {
# Enable VAAPI
config.nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;};
};
config.hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
intel-vaapi-driver
vaapiVdpau
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
vpl-gpu-rt # QSV on 11th gen or newer
];
};
# Create folder for media
config.system.activationScripts."jellyfinMediaFolder" = lib.stringAfter ["var"] ''
mkdir -p /media
chmod -R 775 /media
chown -R jellyfin:jellyfin /media
'';
# Enable Jellyfin
config.services.jellyfin = {
enable = true;
openFirewall = false; # We want jellyfin behind a reverse proxy
};
# Route subdomain traffic to jellyfin
# services.caddy.virtualHosts."jf.spoodythe.one" = {
# enable = true;
# extraConfig = ''
# reverse_proxy * ${host}:${toString port}
# '';
# };
config.services.nginx.
virtualHosts."media.spoodythe.one" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${host}:${toString port}";
};
};
# Open port 80 and 443 for reverse proxy
config.networking.firewall.allowedTCPPorts = [80 443];
config.networking.firewall.allowedUDPPorts = [80 443];
}