Files
2026-10-27 05:49:38 -05:00

43 lines
859 B
Nix

{
lib,
stdenvNoCC,
# baked into <meta name="bug-tv-api" content="..."> of every top-level page
apiBase ? "https://api-tv.bug.tools",
}:
let
sedExpr = ''s#(<meta[[:space:]]+name="bug-tv-api"[[:space:]]+content=")[^"]*(")#\1${
lib.escape [ "\\" "&" "#" ] apiBase
}\2#'';
in
stdenvNoCC.mkDerivation {
pname = "bug-tv-web";
version = (lib.importJSON ../package.json).version;
src = ../web;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
cp -r . $out
chmod -R u+w $out
# no-op on pages without the tag
for page in $out/*.html; do
sed -i -E ${lib.escapeShellArg sedExpr} "$page"
done
runHook postInstall
'';
passthru = { inherit apiBase; };
meta = {
description = "bug.tv static web frontend (API: ${apiBase})";
platforms = lib.platforms.all;
};
}