dotfiles/modules/nixos/services/jellyfin.nix

32 lines
728 B
Nix
Raw Normal View History

{ config, lib, ... }: {
options = {
streamServer = lib.mkOption {
2023-01-21 14:29:03 +00:00
type = lib.types.nullOr lib.types.str;
description = "Hostname for Jellyfin library";
2022-12-21 21:18:03 +00:00
default = null;
};
};
2022-12-21 21:38:34 +00:00
config = lib.mkIf (config.streamServer != null) {
services.jellyfin.enable = true;
2022-12-21 21:18:03 +00:00
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 jellyfin"
"d /var/lib/jellyfin/library 0775 jellyfin jellyfin"
];
};
}