mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-30 02:15:38 +00:00
2337db0bda
also break out packages into individual systems
39 lines
927 B
Nix
39 lines
927 B
Nix
{ config, 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;
|
|
users.users.jellyfin = {
|
|
isSystemUser = true;
|
|
group = "jellyfin";
|
|
};
|
|
|
|
caddy.routes = [{
|
|
match = [{ host = [ config.streamServer ]; }];
|
|
handle = [{
|
|
handler = "reverse_proxy";
|
|
upstreams = [{ dial = "localhost:8096"; }];
|
|
}];
|
|
}];
|
|
|
|
# Grant user access to Jellyfin directories
|
|
users.users.${config.user}.extraGroups = [ "jellyfin" ];
|
|
|
|
# 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"
|
|
];
|
|
|
|
};
|
|
|
|
}
|