dotfiles/modules/nixos/services/jellyfin.nix
2023-06-06 00:56:52 +00:00

41 lines
981 B
Nix

{ config, pkgs, lib, ... }: {
options = {
streamServer = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Hostname for Jellyfin library";
default = null;
};
};
config = lib.mkIf (config.streamServer != null) {
services.jellyfin.enable = true;
services.jellyfin.group = "media";
users.users.jellyfin = { isSystemUser = true; };
caddy.routes = [{
match = [{ host = [ config.streamServer ]; }];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:8096"; }];
}];
}];
# Create videos directory, allow anyone in Jellyfin group to manage it
systemd.tmpfiles.rules = [
"d /var/lib/jellyfin 0775 jellyfin media"
"d /var/lib/jellyfin/library 0775 jellyfin media"
];
# Enable VA-API for hardware transcoding
hardware.opengl = {
enable = true;
driSupport = true;
extraPackages = [ pkgs.libva ];
};
};
}