2022-08-08 20:20:44 +02:00
|
|
|
{ ... }:
|
2023-01-31 08:51:19 +01:00
|
|
|
let
|
|
|
|
|
cfg = import ./vars.nix;
|
|
|
|
|
domain = cfg.jellyfin.domain;
|
|
|
|
|
port = cfg.jellyfin.port;
|
|
|
|
|
ip = "127.0.0.1";
|
|
|
|
|
common_header = ''
|
|
|
|
|
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
|
2022-08-08 20:20:44 +02:00
|
|
|
{
|
2023-01-31 08:51:19 +01:00
|
|
|
|
|
|
|
|
virtualisation.oci-containers.containers.jellyfin = {
|
2024-08-27 23:56:53 +02:00
|
|
|
image = "docker.io/jellyfin/jellyfin";
|
|
|
|
|
#image = "ghcr.io/confusedpolarbear/jellyfin-intro-skipper";
|
|
|
|
|
extraOptions = cfg.podman.extraOptions ++ [
|
|
|
|
|
"--group-add=303"
|
|
|
|
|
"--device=/dev/dri/renderD128:/dev/dri/renderD128"
|
|
|
|
|
"--health-startup-cmd=curl -Lk -fsS http://localhost:8096/health || exit 1"
|
|
|
|
|
"--health-start-period=30s"
|
|
|
|
|
];
|
|
|
|
|
ports = [
|
|
|
|
|
"${port}:${port}"
|
|
|
|
|
"1900:1900/udp"
|
|
|
|
|
"7359:7359/udp"
|
|
|
|
|
];
|
2023-01-31 08:51:19 +01:00
|
|
|
volumes = [
|
|
|
|
|
"/var/lib/jellyfin:/config"
|
2024-08-27 23:56:53 +02:00
|
|
|
"/mnt/cache/jellyfin/metadata:/config/metadata"
|
|
|
|
|
"/mnt/cache/jellyfin/cache:/cache"
|
|
|
|
|
"/mnt/mergerfs/media:/media:ro"
|
|
|
|
|
"/mnt/mergerfs/recorded:/recorded"
|
2023-01-31 08:51:19 +01:00
|
|
|
];
|
2024-08-27 23:56:53 +02:00
|
|
|
autoStart = false;
|
2022-08-10 12:03:35 +02:00
|
|
|
};
|
|
|
|
|
|
2023-01-31 08:51:19 +01:00
|
|
|
imports = [ ./nginx.nix ];
|
|
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${domain} = {
|
|
|
|
|
forceSSL = true;
|
|
|
|
|
enableACME = true;
|
|
|
|
|
|
|
|
|
|
locations."/" = {
|
|
|
|
|
proxyPass = "http://${ip}:${port}";
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
${common_header}
|
|
|
|
|
proxy_buffering off;
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
locations."= /web/" = {
|
|
|
|
|
proxyPass = "http://${ip}:${port}/web/index.html";
|
|
|
|
|
extraConfig = common_header;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
locations."/socket" = {
|
|
|
|
|
proxyPass = "http://${ip}:${port}";
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
${common_header}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
access_log /var/log/nginx/${domain}_access.log;
|
|
|
|
|
error_log /var/log/nginx/${domain}_error.log;
|
|
|
|
|
client_max_body_size 20M;
|
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
|
|
|
add_header X-Content-Type-Options "nosniff";
|
|
|
|
|
'';
|
|
|
|
|
|
2022-08-08 20:20:44 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# vim: set et ts=2 sw=2 ai:
|