{ config, lib, ... }: let cfg = config.profile.services.jellyfin; dataDir = "/nas/mediaserver/jellyfin"; domain = "jellyfin.tigor.web.id"; domain-jellyseerr = "jellyseerr.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 = '' @public not remote_ip private_ranges handle_path /metrics { header @public Content-Type text/html respond @public <