mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-15 14:22:43 +00:00
scripts/desktop-sandbox.sh runs a Hermes desktop instance in an isolated sandbox — separate HERMES_HOME, separate Electron userData, and a distinct app name (HERMES_DESKTOP_APP_NAME) so it doesn't compete with the main desktop instance's single-instance lock. Two modes: - Ephemeral (default): temp dir, cleaned up on exit - --persistent: stored under .hermes-sandbox/ in the worktree git root, survives restarts for repeat testing In the Nix devShell the script is available as 'sandbox'. Also makes APP_NAME overridable via HERMES_DESKTOP_APP_NAME in main.ts — app.setName() runs before requestSingleInstanceLock(), so the overridden name changes the lock key. collectRelaunchEnv already preserves HERMES_DESKTOP_* vars through self-update relaunches; test updated to cover the new env var.
53 lines
1.9 KiB
Nix
53 lines
1.9 KiB
Nix
# nix/devShell.nix — Dev shell that delegates setup to each package
|
|
#
|
|
# Each npm workspace package exposes passthru.packageJsonPath (e.g.
|
|
# "ui-tui/package.json"). This file collects them all and passes the
|
|
# list to mkNpmDevShellHook, which stamps all package.jsons at once,
|
|
# then runs a single `npm i --package-lock-only` if any changed and
|
|
# `npm ci` if the lockfile changed.
|
|
{ ... }:
|
|
{
|
|
perSystem =
|
|
{ pkgs, self', ... }:
|
|
let
|
|
packages = builtins.attrValues self'.packages;
|
|
hermesNpmLib = self'.packages.default.passthru.hermesNpmLib;
|
|
|
|
# Collect all packageJsonPath values from npm workspace packages.
|
|
npmPackageJsonPaths = builtins.filter (p: p != null) (
|
|
map (p: p.passthru.packageJsonPath or null) packages
|
|
);
|
|
|
|
# Non-npm packages may have their own devShellHook (e.g. hermes-agent
|
|
# stamps pyproject.toml + uv.lock for Python venv setup).
|
|
nonNpmHooks = map (p: p.passthru.devShellHook or "") packages;
|
|
combinedNonNpm = pkgs.lib.concatStringsSep "\n" (builtins.filter (h: h != "") nonNpmHooks);
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
packages =
|
|
with pkgs;
|
|
[
|
|
(pkgs.runCommand "hermes" { } ''
|
|
mkdir -p $out/bin
|
|
install -Dm755 ${../hermes} $out/bin/hermes
|
|
'')
|
|
(pkgs.runCommand "dev-sandbox" { } ''
|
|
mkdir -p $out/bin
|
|
install -Dm755 ${../scripts/dev-sandbox.sh} $out/bin/sandbox
|
|
'')
|
|
uv
|
|
]
|
|
++ self'.packages.default.passthru.devDeps;
|
|
shellHook = ''
|
|
${combinedNonNpm}
|
|
${hermesNpmLib.mkNpmDevShellHook npmPackageJsonPaths}
|
|
|
|
# for the devshell to pick up the src
|
|
export HERMES_PYTHON_SRC_ROOT=$(git rev-parse --show-toplevel)
|
|
echo "Hermes Agent dev shell in $HERMES_PYTHON_SRC_ROOT"
|
|
echo "Ready. Run 'hermes' or 'sandbox hermes' to start."
|
|
'';
|
|
};
|
|
};
|
|
}
|