2022-10-02 17:40:10 +00:00
|
|
|
{ config, lib, ... }: {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
streamServer = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Hostname for Jellyfin library";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
|
|
services.jellyfin.enable = true;
|
|
|
|
|
|
|
|
caddyRoutes = [{
|
|
|
|
match = [{ host = [ config.streamServer ]; }];
|
|
|
|
handle = [{
|
|
|
|
handler = "reverse_proxy";
|
|
|
|
upstreams = [{ dial = "localhost:8096"; }];
|
|
|
|
}];
|
|
|
|
}];
|
2022-10-04 22:59:28 +00:00
|
|
|
|
|
|
|
# Create videos directory, allow anyone in Jellyfin group to manage it
|
2022-10-09 03:51:25 +00:00
|
|
|
systemd.services.videos-library = {
|
|
|
|
wantedBy = [ "jellyfin.service" ];
|
|
|
|
requiredBy = [ "jellyfin.service" ];
|
|
|
|
before = [ "jellyfin.service" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
};
|
|
|
|
script = let videosDirectory = "/var/videos";
|
|
|
|
in ''
|
|
|
|
mkdir --parents --mode 0755 ${videosDirectory}
|
|
|
|
chown jellyfin:jellyfin ${videosDirectory}
|
2022-10-04 22:59:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-10-02 17:40:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|