NixOS/system/services/jellyfin.nix

26 lines
657 B
Nix
Raw Normal View History

2024-06-17 23:28:22 +07:00
{ config, lib, ... }:
let
cfg = config.profile.services.jellyfin;
dataDir = "/nas/mediaserver/jellyfin";
domain = "jellyfin.tigor.web.id";
inherit (lib) mkIf;
username = config.profile.user.name;
in
{
config = mkIf cfg.enable {
users.users.${username}.extraGroups = [ "jellyfin" ];
users.users.jellyfin.extraGroups = [ username ];
system.activationScripts.jellyfin-prepare = ''
mkdir -p ${dataDir}
chmod -R 0777 /nas/mediaserver
'';
services.caddy.virtualHosts.${domain}.extraConfig = ''
reverse_proxy 0.0.0.0:8096
'';
services.jellyfin = {
enable = true;
inherit dataDir;
};
};
}