depot/cluster/services/warehouse/host.nix
2023-09-03 01:11:49 +02:00

40 lines
1.3 KiB
Nix

{ config, depot, lib, pkgs, ... }:
with depot.lib.nginx;
{
# TODO: not a whole lot to configure, maybe add some autoconfig stuff
services.jellyfin = {
enable = true;
package = depot.packages.jellyfin;
};
services.nginx.virtualHosts."warehouse.${depot.lib.meta.domain}" = lib.mkMerge [
(vhosts.proxy "http://127.0.0.1:8096")
{
locations."/".extraConfig = ''
proxy_buffering off;
'';
locations."/socket" = {
inherit (config.services.nginx.virtualHosts."warehouse.${depot.lib.meta.domain}".locations."/") proxyPass;
proxyWebsockets = true;
};
# TODO: video cache
}
];
hardware.opengl = {
enable = true;
package = pkgs.intel-media-driver;
};
systemd.services.jellyfin = {
# if EncoderAppPath is manually set in the web UI, it can never be updated through --ffmpeg
preStart = "test ! -e /var/lib/jellyfin/config/encoding.xml || sed -i '/<EncoderAppPath>/d' /var/lib/jellyfin/config/encoding.xml";
serviceConfig = {
# allow access to GPUs for hardware transcoding
DeviceAllow = lib.mkForce "char-drm";
BindPaths = lib.mkForce "/dev/dri";
# to allow restarting from web ui
Restart = lib.mkForce "always";
Slice = "mediaplayback.slice";
};
};
}