Files
4DBug 7de90b5b7c v2: watch-party Activity
The Activity is now the full bug.tv site plus a small Discord overlay. Whoever
starts the instance hosts and controls everything; everyone else mirrors the
host's page and playback. The server is a relay keyed by activity instance and
checks membership through Discord's activity-instances API, so it works in DM
and group calls. The bot gateway, slash commands and control message are gone.
2026-10-27 10:00:34 -05:00

60 lines
1.5 KiB
Nix

{
lib,
buildNpmPackage,
importNpmLock,
nodejs_22,
esbuild,
# bug-tv's static web package; overridden here so the site talks to the /tv URL mapping
bugTvWeb,
}:
let
web = bugTvWeb.override { apiBase = "/tv"; };
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.unions [
(lib.fileset.difference ../activity (lib.fileset.maybeMissing ../activity/dist))
../scripts/build-activity.sh
../package.json
../package-lock.json
];
};
pkgJson = lib.importJSON ../package.json;
in
buildNpmPackage {
pname = "bug-tv-discord-activity";
inherit (pkgJson) version;
inherit src;
nodejs = nodejs_22;
# same lockfile as the server; @discord/embedded-app-sdk is resolved from node_modules by esbuild
npmDeps = importNpmLock { npmRoot = src; };
npmConfigHook = importNpmLock.npmConfigHook;
# npm's esbuild needs its postinstall binary download; nixpkgs' esbuild is used instead
npmFlags = [ "--ignore-scripts" ];
# the whole bug.tv site + discord.js (SDK + party transport) + overlay.css
buildPhase = ''
runHook preBuild
ESBUILD=${lib.getExe esbuild} bash scripts/build-activity.sh ${web} site
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r site $out
runHook postInstall
'';
passthru = { inherit web; };
meta = {
description = "bug.tv Discord Activity: the bug.tv site with the watch-party overlay (static files)";
homepage = "https://git.bug.tools/bug/tv-discord";
platforms = lib.platforms.all;
};
}