feat: add Jellyfin service module with configuration options

This commit is contained in:
Giulio De Pasquale (aider) 2025-04-26 16:51:50 +01:00
parent a44533a0e0
commit 3c44bbc034
2 changed files with 69 additions and 0 deletions

View File

@ -3,6 +3,7 @@
./bazarr
./gitea
./immich
./jellyfin
./prowlarr
./radarr
./sonarr

View File

@ -0,0 +1,68 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkForce;
cfg = config.pepe.services.jellyfin;
in
{
options.pepe.services.jellyfin = with lib; {
enable = mkEnableOption "Enable jellyfin";
package = mkPackageOption pkgs "jellyfin" { };
domain = mkOption {
type = types.str;
default = null;
};
tmpfsSize = mkOption {
type = types.str;
default = "20G";
description = "Size of the tmpfs mount for Jellyfin";
};
};
config = mkIf cfg.enable {
# needed since StateDirectory does not accept symlinks
systemd.services.jellyfin.serviceConfig.StateDirectory = mkForce "";
architect.vhost.${cfg.domain} = with config.architect.networks; {
dnsInterfaces = [ "lan" "tailscale" ];
locations = {
"/" = {
port = 8096;
allowLan = true;
allow = [
tailscale.net
];
};
"/socket" = {
port = 8096;
allowLan = true;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
};
};
services.jellyfin = {
enable = true;
group = "media";
package = cfg.package;
};
users.groups = {
video.members = [ "jellyfin" ];
render.members = [ "jellyfin" ];
};
pepe.core.media.groupMembers = mkIf config.pepe.core.media.enable [ "jellyfin" ];
fileSystems."/tmp/jellyfin" = {
device = "none";
fsType = "tmpfs";
options = [ "defaults" "size=${cfg.tmpfsSize}" "uid=jellyfin" ];
};
};
}