Files
hermes-agent/nix/webapp.nix
unsupportedpastels 3f2b1722b1 feat(nix): ship the Webapp in the Nix package
The Nix package had no Webapp bundle, and `hermes webapp` could not build
one in the read-only store. nix/webapp.nix builds it in the npm workspace
the hook prepares (no native rebuild, no Electron), exposed as
`.#webapp`. The agent assembler takes it as a `webapp` frontend: the
wrapper sets HERMES_WEBAPP_DIST to it, as HERMES_WEB_DIST is set for the
dashboard.

hermes_cli/webapp.py serves a HERMES_WEBAPP_DIST bundle as shipped: no
freshness check, no build lock, never rebuilt or marked stale, and
`--force-build` says it cannot rebuild it.
2026-10-27 09:42:22 -04:00

38 lines
1.0 KiB
Nix

# The Webapp: the Desktop renderer built for a browser. The npm hook has
# already installed the locked workspace, so it compiles there, with no
# private workspace and no Electron.
{ hermesNpmLib, ... }:
hermesNpmLib.buildNpmPackage {
dirs = [
"apps/desktop"
"apps/shared"
"scripts/build/webapp.mjs"
"scripts/build/node-deps.mjs"
"scripts/build/freshness.mjs"
"scripts/build/frontend-common.mjs"
];
pname = "hermes-webapp";
# The browser bundle loads no native module (node-pty belongs to Desktop),
# so none is compiled.
npmRebuildFlags = [ "--ignore-scripts" ];
doCheck = false;
buildPhase = ''
runHook preBuild
node --input-type=module -e '
import { buildWebapp } from "./scripts/build/webapp.mjs"
await buildWebapp({ source: process.cwd(), workspace: process.cwd(), out: `''${process.env.TMPDIR}/webapp-product` })
'
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r "$TMPDIR/webapp-product/." $out/
runHook postInstall
'';
}