nixos-config/hosts/x86_64-linux/beleth/jellyfin.nix
2024-04-01 02:29:05 +02:00

74 lines
2.1 KiB
Nix

{
config,
pkgs,
lib,
...
}: let
proxyConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
'';
in {
environment.systemPackages = with pkgs; [
jellyfin
jellyfin-web
jellyfin-ffmpeg
];
nixpkgs.config.packageOverrides = pkgs: {
intel-vaapi-driver =
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
};
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
];
};
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD";
}; # Force intel-media-driver
services.jellyfin.enable = true;
# services.jellyfin.openFirewall = true;
services.jellyfin.user = "xqtc";
services.nginx.virtualHosts."jellyfin.heroin.trade" = {
# addSSL = true;
# kTLS = true;
forceSSL = true;
enableACME = true;
locations = {
# "= /".return = "302 https://$host/web/";
"/" = {
# extraConfig = ''
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Protocol $scheme;
# proxy_set_header X-Forwarded-Host $http_host;
# proxy_buffering on;
# '';
proxyPass = "http://127.0.0.1:8096";
proxyWebsockets = true;
};
# "= /web/" = {
# proxyPass = "http://127.0.0.1:8096/web/index.html";
# extraConfig = proxyConfig;
# };
# "/socket" = {
# proxyPass = "http://127.0.0.1:8096";
# proxyWebsockets = true;
# extraConfig = proxyConfig;
# };
};
};
}