diff --git a/.envrc b/.envrc index fe49ded56a..cecedd0c18 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,4 @@ -watch_file flake.nix flake.lock hermes pyproject.toml uv.lock +watch_file flake.nix flake.lock pyproject.toml uv.lock watch_file pnpm-lock.yaml pnpm-workspace.yaml package.json web/package.json ui-tui/package.json website/package.json apps/shared/package.json apps/desktop/package.json ui-tui/packages/hermes-ink/package.json watch_dir nix watch_dir pm diff --git a/nix/devShell.nix b/nix/devShell.nix index 14ed4bba48..189fbd9874 100644 --- a/nix/devShell.nix +++ b/nix/devShell.nix @@ -23,10 +23,6 @@ { devShells.default = pkgs.mkShell { packages = with pkgs; [ - (pkgs.runCommand "hermes" { } '' - mkdir -p $out/bin - install -Dm755 ${../hermes} $out/bin/hermes - '') self'.packages.sandbox ] # Wayland-only: cage and ghostty pull alsa-lib, which does not @@ -62,7 +58,7 @@ export NIX_SSL_CERT_FILE="$SSL_CERT_FILE" echo "Hermes Agent dev shell in $HERMES_PYTHON_SRC_ROOT" - echo "Ready. Run 'hermes' or 'sandbox hermes' to start." + echo "Ready. 'hermes-checkout' runs this checkout; 'hermes' stays your installed Hermes." ''; }; }; diff --git a/nix/hermes-agent.nix b/nix/hermes-agent.nix index 47168f3a6e..bbfebcc8a2 100644 --- a/nix/hermes-agent.nix +++ b/nix/hermes-agent.nix @@ -351,8 +351,11 @@ stdenv.mkDerivation (finalAttrs: { # site-packages are devPython's, so `.pth` files (the editable checkout) # load and nothing depends on the caller's PYTHONPATH. Console scripts # are re-shebanged onto it so `pytest` and `python -m pytest` agree. + # The project's own commands (`hermes`, ...) go to libexec, off PATH, so + # the dev shell never hides the installed Hermes; `hermes-checkout` runs them. + projectCommands = builtins.attrNames (lib.importTOML ../pyproject.toml).project.scripts; devVenv = runCommand "hermes-agent-dev-venv" { } '' - mkdir -p $out/bin $out/lib/python${python.pythonVersion} + mkdir -p $out/bin $out/libexec/hermes-checkout $out/lib/python${python.pythonVersion} ln -s ${devPython}/${sitePackagesPath} $out/${sitePackagesPath} cat > $out/pyvenv.cfg < "$out/bin/$name" - chmod +x "$out/bin/$name" + { echo "#!$out/bin/python3"; tail -n +2 "$script"; } > "$dir/$name" + chmod +x "$dir/$name" else - ln -s "$script" "$out/bin/$name" + ln -s "$script" "$dir/$name" fi done + # The libexec name stays `hermes`: process identity and relaunch read argv[0]. + printf '#!/bin/sh\nexec %s "$@"\n' "$out/libexec/hermes-checkout/hermes" > $out/bin/hermes-checkout + chmod +x $out/bin/hermes-checkout ''; pm = writeShellApplication { diff --git a/nix/sandbox.nix b/nix/sandbox.nix index 5d5fd84d37..78cef143e3 100644 --- a/nix/sandbox.nix +++ b/nix/sandbox.nix @@ -1,6 +1,6 @@ { # Electron needs its native runtime libraries on LD_LIBRARY_PATH when the - # sandboxed command launches the desktop app (`sandbox hermes desktop`, + # sandboxed command launches the desktop app (`sandbox hermes-checkout desktop`, # `sandbox pnpm run dev`); nothing else in the sandbox is nix-specific. alsa-lib, at-spi2-atk, diff --git a/website/docs/getting-started/nix-setup.md b/website/docs/getting-started/nix-setup.md index 64fe44b68f..ccff056839 100644 --- a/website/docs/getting-started/nix-setup.md +++ b/website/docs/getting-started/nix-setup.md @@ -94,7 +94,7 @@ The `default` package adds ~700 MB to the closure. If you only need messaging pl git clone https://github.com/NousResearch/hermes-agent.git cd hermes-agent nix develop -hermes setup +hermes-checkout setup ``` @@ -940,12 +940,17 @@ and it needs no `PYTHONPATH`. It does not install Python dependencies into a repository-local `.venv`. The shell also provides Node.js and runtime tools. Its pnpm hook refreshes JS workspaces when their inputs change. +The shell does not change which `hermes` runs. `hermes` stays your installed Hermes, so you +can keep using it while you work on the checkout. `hermes-checkout` runs this checkout's code +and takes the same arguments. Give it a separate `HERMES_HOME` when a change touches stored +state, because both commands read the same one by default. + ```bash cd hermes-agent nix develop "$HERMES_PYTHON" -c "import sys; print(sys.executable); print(sys.version)" -hermes setup -hermes chat +hermes-checkout --version +HERMES_HOME="$PWD/.scratch/home" hermes-checkout chat ``` ### direnv (Recommended)