Skip to content

feat: nix flake — uv2nix build, NixOS module, persistent container mode#20

Merged
alt-glitch merged 16 commits into
mainfrom
sid/nix-flake
Mar 25, 2026
Merged

feat: nix flake — uv2nix build, NixOS module, persistent container mode#20
alt-glitch merged 16 commits into
mainfrom
sid/nix-flake

Conversation

@alt-glitch

@alt-glitch alt-glitch commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • nix build produces a fully self-contained package — all Python deps are Nix derivations via uv2nix, no runtime pip
  • nix develop provides a dev shell with Python 3.11, uv, node, ripgrep, git, ffmpeg
  • NixOS module with two deployment modes: native systemd service (hardened) or persistent OCI container (Ubuntu 24.04 base, writable layer survives restarts and rebuilds)
  • Managed mode guards block hermes setup, config set, gateway install/uninstall when running under the NixOS module
  • CI workflow validates Nix build on linux x86 with every PR (macOS skipped — onnxruntime wheel missing on aarch64-darwin)

What changed

  • flake.nix — flake entrypoint wiring all Nix outputs (package, dev shell, NixOS module, checks)
  • nix/python.nix — uv2nix Python 3.11 venv derivation
  • nix/packages.nix — wraps uv2nix venv entry points (hermes, hermes-agent, hermes-acp) with runtime PATH (git, node, ripgrep, ffmpeg, openssh). Bundles skills/ into share/hermes-agent/skills (filtered to exclude index-cache/) and sets HERMES_BUNDLED_SKILLS env var so skills_sync finds them in the Nix store
  • nix/nixosModules.nix — NixOS module with full declarative config surface:
    • Mode A (native): systemd service with ProtectSystem=strict, NoNewPrivileges, secret env files
    • Mode B (container): persistent Ubuntu container with /nix/store bind-mounted read-only. Runs as --user UID:GID matching configured service user. Hermes runs via a current-package symlink updated on rebuild. Identity hash triggers container recreation only on image/env/volume changes — apt/pip/npm installs persist across restarts, rebuilds, reboots, and GC
    • Declarative settings (deep-merged via nix/configMergeScript.nix, rendered as config.yaml), documents, mcpServers, sops-nix/agenix-compatible environmentFiles, OAuth authFile seeding
  • nix/config-keys.json — exhaustive list of valid config keys for build-time validation of declarative settings
  • nix/checks.nix — build-time verification: binary existence, entry point sync with pyproject.toml, CLI subcommands, HERMES_MANAGED guard coverage, bundled skills presence
  • nix/devShell.nix — stamp-file-optimized dev shell
  • .github/workflows/nix.yml — CI workflow running nix flake check + nix build on linux x86 with DeterminateSystems magic-nix-cache
  • tools/skills_sync.py_get_bundled_dir() checks HERMES_BUNDLED_SKILLS env var before falling back to relative path
  • tests/tools/test_skills_sync.py — tests for HERMES_BUNDLED_SKILLS env var override
  • hermes_cli/config.pyis_managed() + managed_error() guards on config mutation paths; fix Path type mismatch in os.getenv default
  • hermes_cli/gateway.py — guards on gateway setup, install, uninstall
  • hermes_cli/setup.py — guard on setup wizard
  • website/docs/getting-started/nix-setup.md — full setup guide: options reference, container architecture, secrets management, persistence model, troubleshooting

Container persistence model

Event Container recreated? State (/data) Writable layer (apt/pip/npm)
systemctl restart No Persists Persists
nixos-rebuild switch No (symlink update) Persists Persists
Host reboot No Persists Persists
nix-collect-garbage No (GC root) Persists Persists
Image/env/volume change Yes Persists Lost

Test plan

  • nix flake check — all outputs evaluate
  • nix build — package builds
  • nix build .#checks.x86_64-linux.{package-contents,cli-commands,managed-guard} — all pass
  • Bundled skills check — 94 skills present in package
  • Entry points sync — hermes, hermes-agent, hermes-acp all wrapped
  • Container created on ubuntu:24.04, service active
  • Container runs as configured user (--user UID:GID)
  • Symlink, GC root, identity hash correct
  • hermes version works inside container
  • apt install cowsay persists across systemctl restart
  • pip install httpie persists across restart
  • npm install -g tldr persists across restart
  • Container ID unchanged after restart
  • Container ID unchanged after nixos-rebuild switch
  • All installs persist after nixos-rebuild switch
  • docker kill → systemd auto-restarts, everything survives
  • nix-collect-garbage doesn't break running agent (GC root protects)
  • Image change triggers container recreation (writable layer reset)
  • Mode switch (container ↔ native)
  • Host reboot persistence

@alt-glitch alt-glitch changed the title feat: add nix flake + setup feat: nix flake — NixOS module, dev shell, and package Mar 9, 2026
@alt-glitch alt-glitch changed the title feat: nix flake — NixOS module, dev shell, and package feat: nix flake — dev shell + home-manager module Mar 11, 2026
@alt-glitch alt-glitch changed the title feat: nix flake — dev shell + home-manager module feat: nix flake — uv2nix build + dev shell + home-manager Mar 11, 2026
@alt-glitch alt-glitch changed the base branch from main to fix/packaging-bugs March 11, 2026 11:33
@alt-glitch alt-glitch marked this pull request as ready for review March 11, 2026 12:11
Comment thread docs/nixos-setup.md Outdated
Comment thread docs/nixos-setup.md Outdated
Comment thread nix/devShell.nix
Comment thread nix/packages.nix Outdated
Comment thread nix/packages.nix
@alt-glitch alt-glitch marked this pull request as draft March 14, 2026 04:43
@0xrsydn

0xrsydn commented Mar 15, 2026

Copy link
Copy Markdown

hi, is there any plan to do native nix supports sooner? I like to try this on my own nixos server, thank u 🙏

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

hey @0xrsydn !
thanks for showing interest. i'll try to push some updates here and get this out soon.
@arilotter will review but would appreciate your feedback / review as well as a fellow nixos user :)

@0xrsydn

0xrsydn commented Mar 16, 2026

Copy link
Copy Markdown

hey @0xrsydn !

thanks for showing interest. i'll try to push some updates here and get this out soon.

@arilotter will review but would appreciate your feedback / review as well as a fellow nixos user :)

actually i have build my own hermes flake for now, but id love to try the native support and give some feedbacks if needed later once its updated, thank you very much 🙏

@0xrsydn

0xrsydn commented Mar 17, 2026

Copy link
Copy Markdown

btw i also have built my own package here and have been working great, deployed on my nixos server and connected to telegram. would love for more suggestion or maybe easier and flexible approach to use hermes agent flake later on

@alt-glitch alt-glitch changed the base branch from fix/packaging-bugs to main March 19, 2026 10:44
@alt-glitch alt-glitch marked this pull request as ready for review March 19, 2026 10:45
@alt-glitch alt-glitch requested a review from ethernet8023 March 19, 2026 10:45
@alt-glitch alt-glitch changed the title feat: nix flake — uv2nix build + dev shell + home-manager feat: nix flake — uv2nix build, NixOS module, persistent container mode Mar 19, 2026
@sylvesterroos

sylvesterroos commented Mar 20, 2026

Copy link
Copy Markdown

Does $HERMES_HOME need to be set using this module? I'm trying it out, and the first run's setup creates a .hermes dir in my home when I would assume that the setup either needs to get skipped or it needs to place the settings in /var/lib/hermes/.hermes

and it might be worth investigating if the container can be recreated automatically if the eg environment file changes. I kept trying to figure out why my new env vars werent being applied but apparently i had to manually recreate the container (by performing the steps in the markdown file)

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

hey @sylvesterroos!
thanks for the comments

The module now sets environment.variables.HERMES_HOME system-wide when addToSystemPackages = true, so running hermes in your shell shares state with the gateway service instead of creating a separate ~/.hermes.

As for the secrets, they are no long injected into the container but read from $HERMES_HOME/.env. So changing env vars requires a systemctl restart hermes-agent to pick up the new values. no container recreation needed

@lattwood

lattwood commented Mar 23, 2026

Copy link
Copy Markdown

@alt-glitch is what's remaining the stuff on your test plan?

edit: ie, does helping with testing get this closer to merged

@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@lattwood -- yes!
if you can run this branch in the config you want (container or local), and gimme a heads up on any bugs, that'd be really helpful.

i'm pushing a couple more fixes right now.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

sudo-yf pushed a commit to sudo-yf/hermes-agent that referenced this pull request Apr 5, 2026
…lish

Sprint 16: Session sidebar visual polish — overlay actions, SVG icons, project borders
@ahmedaltewaj

Copy link
Copy Markdown

QA Evidence — Quick Scan 2026-04-06

Confirmed 401 errors on /app/knowledge-graph:

Failed to load resource: the server responded with a status of 401 ()

Also Mixed Content error on same page:

Mixed Content: The page at 'https://leksikon.ai/app/knowledge-graph' was loaded over HTTPS, 
but requested an insecure resource 'http://leksikon.ai/api/v1/advisories/?page=1&limit=50'. 

Also observed 429 on /app/advisories (rate limit).

Mode: quick_scan
QA agent run: 2026-04-06
EOF; __hermes_rc=$?; printf 'HERMES_FENCE_a9f7b3'; exit $__hermes_rc

@ahmedaltewaj

This comment was marked as off-topic.

h4x3rotab pushed a commit to Clawdi-AI/hermes-agent that referenced this pull request Apr 10, 2026
Co-authored-by: Aurora <aurora@MacBookPro.lan>
forsonny pushed a commit to forsonny/hermes-agent that referenced this pull request Apr 11, 2026
Covers the untested foundation layer of the auth module:
- has_usable_secret(), _token_fingerprint() (input validation)
- _parse_iso_timestamp(), _is_expiring(), _coerce_ttl_seconds() (time helpers)
- _optional_base_url(), _decode_jwt_claims() (URL/JWT parsing)
- AuthError, format_auth_error() (error types and formatting)
- _load_auth_store(), _save_auth_store() (persistence layer)
- _load_provider_state(), _save_provider_state() (state management)
- read_credential_pool(), write_credential_pool() (credential pools)
- suppress_credential_source(), is_source_suppressed() (source suppression)
- get_active_provider(), get_provider_auth_state() (status queries)
- resolve_provider() with alias resolution and auto-detection
- _resolve_kimi_base_url() (Kimi URL routing)
- clear_provider_auth(), deactivate_provider() (auth lifecycle)
- ProviderConfig, PROVIDER_REGISTRY, ZAI_ENDPOINTS (constants)
- detect_zai_endpoint() with mocked HTTP
- get_auth_status(), get_api_key_provider_status() (status dispatchers)
- resolve_api_key_provider_credentials() (credential resolution)
- get_external_process_provider_status() (subprocess providers)
- _codex_access_token_is_expiring() (JWT expiration)
- _oauth_trace_enabled(), _oauth_trace() (tracing)
- _auth_store_lock() (cross-process locking)

This addresses the highest-priority coverage gap: auth.py had 3177 lines
and zero dedicated tests for its core functions (backlog item NousResearch#20).

Self-improve: automated improvement
malaiwah added a commit to malaiwah/hermes-agent that referenced this pull request Apr 13, 2026
## Summary

This extracts the AI-review work out of NousResearch#18 into its own PR.

Included here:
- hardened PR comment upsert + inline review posting
- structured-output parsing and improved diff-grounding
- bounded local verification and parallel per-issue verification
- tokenizer-backed / token-aware context packing
- trace output and cumulative cache-aware usage accounting
- focused regression coverage in `tests/gitea/test_ai_review.py`

Not included here:
- platform context seeding/history-fetch gateway changes from NousResearch#18

## Validation

- `source venv/bin/activate && python -m pytest tests/gitea/test_ai_review.py -q`

Co-authored-by: Michel Belleau <mbelleau@Michels-MacBook-Pro.local>
Reviewed-on: http://10.15.0.6:3300/angelos/hermes-agent/pulls/20
@Jack04Fireball

This comment was marked as off-topic.

angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…de (NousResearch#20)

* feat: nix flake, uv2nix build, dev shell and home manager

* fixed nix run, updated docs for setup

* feat(nix): NixOS module with persistent container mode, managed guards, checks

- Replace homeModules.nix with nixosModules.nix (two deployment modes)
- Mode A (native): hardened systemd service with ProtectSystem=strict
- Mode B (container): persistent Ubuntu container with /nix/store bind-mount,
  identity-hash-based recreation, GC root protection, symlink-based updates
- Add HERMES_MANAGED guards blocking CLI config mutation (config set, setup,
  gateway install/uninstall) when running under NixOS module
- Add nix/checks.nix with build-time verification (binary, CLI, managed guard)
- Remove container.nix (no Nix-built OCI image; pulls ubuntu:24.04 at runtime)
- Simplify packages.nix (drop fetchFromGitHub submodules, PYTHONPATH wrappers)
- Rewrite docs/nixos-setup.md with full options reference, container
  architecture, secrets management, and troubleshooting guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Update config.py

* feat(nix): add CI workflow and enhanced build checks
- GitHub Actions workflow for nix flake check + build on linux/macOS
- Entry point sync check to catch pyproject.toml drift
- Expanded managed-guard check to cover config edit
- Wrap hermes-acp binary in Nix package
- Fix Path type mismatch in is_managed()

* Update MCP server package name; bundled skills support

* fix reading .env. instead have container user a common mounted .env file

* feat(nix): container entrypoint with privilege drop and sudo provisioning

Container was running as non-root via --user, which broke apt/pip installs
and caused crashes when $HOME didn't exist. Replace --user with a Nix-built
entrypoint script that provisions the hermes user, sudo (NOPASSWD), and
/home/hermes inside the container on first boot, then drops privileges via
setpriv. Writable layer persists so setup only runs once.

Also expands MCP server options to support HTTP transport and sampling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix group and user creation in container mode

* feat(nix): persistent /home/hermes and MESSAGING_CWD in container mode

Container mode now bind-mounts ${stateDir}/home to /home/hermes so the
agent's home directory survives container recreation. Previously it lived
in the writable layer and was lost on image/volume/options changes.

Also passes MESSAGING_CWD to the container so the agent finds its
workspace and documents, matching native mode behavior.

Other changes:
- Extract containerDataDir/containerHomeDir bindings (no more magic strings)
- Fix entrypoint chown to run unconditionally (volume mounts always exist)
- Add schema field to container identity hash for auto-recreation
- Add idempotency test (Scenario G) to config-roundtrip check

* docs: add Nix & NixOS setup guide to docs site

Add comprehensive Nix documentation to the Docusaurus site at
website/docs/getting-started/nix-setup.md, covering nix run/profile
install, NixOS module (native + container modes), declarative settings,
secrets management, MCP servers, managed mode, container architecture,
dev shell, flake checks, and full options reference.

- Register nix-setup in sidebar after installation page
- Add Nix callout tip to installation.md linking to new guide
- Add canonical version pointer in docs/nixos-setup.md

* docs: remove docs/nixos-setup.md, consolidate into website docs

Backfill missing details (restart/restartSec in full example,
gateway.pid, 0750 permissions, docker inspect commands) into
the canonical website/docs/getting-started/nix-setup.md and
delete the old standalone file.

* fix(nix): add compression.protect_last_n and target_ratio to config-keys.json

New keys were added to DEFAULT_CONFIG on main, causing the
config-drift check to fail in CI.

* fix(nix): skip checks on aarch64-darwin (onnxruntime wheel missing)

The full Python venv includes onnxruntime (via faster-whisper/STT)
which lacks a compatible uv2nix wheel on aarch64-darwin. Gate all
checks behind stdenv.hostPlatform.isLinux. The package and devShell
still evaluate on macOS.

* fix(nix): skip flake check and build on macOS CI

onnxruntime (transitive dep via faster-whisper) lacks a compatible
uv2nix wheel on aarch64-darwin. Run full checks and build on Linux
only; macOS CI verifies the flake evaluates without building.

* fix(nix): preserve container writable layer across nixos-rebuild

The container identity hash included the entrypoint's Nix store path,
which changes on every nixpkgs update (due to runtimeShell/stdenv
input-addressing). This caused false-positive identity mismatches,
triggering container recreation and losing the persistent writable layer.

- Use stable symlink (current-entrypoint) like current-package already does
- Remove entrypoint from identity hash (only image/volumes/options matter)
- Add GC root for entrypoint so nix-collect-garbage doesn't break it
- Remove global HERMES_HOME env var from addToSystemPackages (conflicted
  with interactive CLI use, service already sets its own)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…de (NousResearch#20)

* feat: nix flake, uv2nix build, dev shell and home manager

* fixed nix run, updated docs for setup

* feat(nix): NixOS module with persistent container mode, managed guards, checks

- Replace homeModules.nix with nixosModules.nix (two deployment modes)
- Mode A (native): hardened systemd service with ProtectSystem=strict
- Mode B (container): persistent Ubuntu container with /nix/store bind-mount,
  identity-hash-based recreation, GC root protection, symlink-based updates
- Add HERMES_MANAGED guards blocking CLI config mutation (config set, setup,
  gateway install/uninstall) when running under NixOS module
- Add nix/checks.nix with build-time verification (binary, CLI, managed guard)
- Remove container.nix (no Nix-built OCI image; pulls ubuntu:24.04 at runtime)
- Simplify packages.nix (drop fetchFromGitHub submodules, PYTHONPATH wrappers)
- Rewrite docs/nixos-setup.md with full options reference, container
  architecture, secrets management, and troubleshooting guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Update config.py

* feat(nix): add CI workflow and enhanced build checks
- GitHub Actions workflow for nix flake check + build on linux/macOS
- Entry point sync check to catch pyproject.toml drift
- Expanded managed-guard check to cover config edit
- Wrap hermes-acp binary in Nix package
- Fix Path type mismatch in is_managed()

* Update MCP server package name; bundled skills support

* fix reading .env. instead have container user a common mounted .env file

* feat(nix): container entrypoint with privilege drop and sudo provisioning

Container was running as non-root via --user, which broke apt/pip installs
and caused crashes when $HOME didn't exist. Replace --user with a Nix-built
entrypoint script that provisions the hermes user, sudo (NOPASSWD), and
/home/hermes inside the container on first boot, then drops privileges via
setpriv. Writable layer persists so setup only runs once.

Also expands MCP server options to support HTTP transport and sampling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix group and user creation in container mode

* feat(nix): persistent /home/hermes and MESSAGING_CWD in container mode

Container mode now bind-mounts ${stateDir}/home to /home/hermes so the
agent's home directory survives container recreation. Previously it lived
in the writable layer and was lost on image/volume/options changes.

Also passes MESSAGING_CWD to the container so the agent finds its
workspace and documents, matching native mode behavior.

Other changes:
- Extract containerDataDir/containerHomeDir bindings (no more magic strings)
- Fix entrypoint chown to run unconditionally (volume mounts always exist)
- Add schema field to container identity hash for auto-recreation
- Add idempotency test (Scenario G) to config-roundtrip check

* docs: add Nix & NixOS setup guide to docs site

Add comprehensive Nix documentation to the Docusaurus site at
website/docs/getting-started/nix-setup.md, covering nix run/profile
install, NixOS module (native + container modes), declarative settings,
secrets management, MCP servers, managed mode, container architecture,
dev shell, flake checks, and full options reference.

- Register nix-setup in sidebar after installation page
- Add Nix callout tip to installation.md linking to new guide
- Add canonical version pointer in docs/nixos-setup.md

* docs: remove docs/nixos-setup.md, consolidate into website docs

Backfill missing details (restart/restartSec in full example,
gateway.pid, 0750 permissions, docker inspect commands) into
the canonical website/docs/getting-started/nix-setup.md and
delete the old standalone file.

* fix(nix): add compression.protect_last_n and target_ratio to config-keys.json

New keys were added to DEFAULT_CONFIG on main, causing the
config-drift check to fail in CI.

* fix(nix): skip checks on aarch64-darwin (onnxruntime wheel missing)

The full Python venv includes onnxruntime (via faster-whisper/STT)
which lacks a compatible uv2nix wheel on aarch64-darwin. Gate all
checks behind stdenv.hostPlatform.isLinux. The package and devShell
still evaluate on macOS.

* fix(nix): skip flake check and build on macOS CI

onnxruntime (transitive dep via faster-whisper) lacks a compatible
uv2nix wheel on aarch64-darwin. Run full checks and build on Linux
only; macOS CI verifies the flake evaluates without building.

* fix(nix): preserve container writable layer across nixos-rebuild

The container identity hash included the entrypoint's Nix store path,
which changes on every nixpkgs update (due to runtimeShell/stdenv
input-addressing). This caused false-positive identity mismatches,
triggering container recreation and losing the persistent writable layer.

- Use stable symlink (current-entrypoint) like current-package already does
- Remove entrypoint from identity hash (only image/volumes/options matter)
- Add GC root for entrypoint so nix-collect-garbage doesn't break it
- Remove global HERMES_HOME env var from addToSystemPackages (conflicted
  with interactive CLI use, service already sets its own)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…de (NousResearch#20)

* feat: nix flake, uv2nix build, dev shell and home manager

* fixed nix run, updated docs for setup

* feat(nix): NixOS module with persistent container mode, managed guards, checks

- Replace homeModules.nix with nixosModules.nix (two deployment modes)
- Mode A (native): hardened systemd service with ProtectSystem=strict
- Mode B (container): persistent Ubuntu container with /nix/store bind-mount,
  identity-hash-based recreation, GC root protection, symlink-based updates
- Add HERMES_MANAGED guards blocking CLI config mutation (config set, setup,
  gateway install/uninstall) when running under NixOS module
- Add nix/checks.nix with build-time verification (binary, CLI, managed guard)
- Remove container.nix (no Nix-built OCI image; pulls ubuntu:24.04 at runtime)
- Simplify packages.nix (drop fetchFromGitHub submodules, PYTHONPATH wrappers)
- Rewrite docs/nixos-setup.md with full options reference, container
  architecture, secrets management, and troubleshooting guide

* Update config.py

* feat(nix): add CI workflow and enhanced build checks
- GitHub Actions workflow for nix flake check + build on linux/macOS
- Entry point sync check to catch pyproject.toml drift
- Expanded managed-guard check to cover config edit
- Wrap hermes-acp binary in Nix package
- Fix Path type mismatch in is_managed()

* Update MCP server package name; bundled skills support

* fix reading .env. instead have container user a common mounted .env file

* feat(nix): container entrypoint with privilege drop and sudo provisioning

Container was running as non-root via --user, which broke apt/pip installs
and caused crashes when $HOME didn't exist. Replace --user with a Nix-built
entrypoint script that provisions the hermes user, sudo (NOPASSWD), and
/home/hermes inside the container on first boot, then drops privileges via
setpriv. Writable layer persists so setup only runs once.

Also expands MCP server options to support HTTP transport and sampling.

* fix group and user creation in container mode

* feat(nix): persistent /home/hermes and MESSAGING_CWD in container mode

Container mode now bind-mounts ${stateDir}/home to /home/hermes so the
agent's home directory survives container recreation. Previously it lived
in the writable layer and was lost on image/volume/options changes.

Also passes MESSAGING_CWD to the container so the agent finds its
workspace and documents, matching native mode behavior.

Other changes:
- Extract containerDataDir/containerHomeDir bindings (no more magic strings)
- Fix entrypoint chown to run unconditionally (volume mounts always exist)
- Add schema field to container identity hash for auto-recreation
- Add idempotency test (Scenario G) to config-roundtrip check

* docs: add Nix & NixOS setup guide to docs site

Add comprehensive Nix documentation to the Docusaurus site at
website/docs/getting-started/nix-setup.md, covering nix run/profile
install, NixOS module (native + container modes), declarative settings,
secrets management, MCP servers, managed mode, container architecture,
dev shell, flake checks, and full options reference.

- Register nix-setup in sidebar after installation page
- Add Nix callout tip to installation.md linking to new guide
- Add canonical version pointer in docs/nixos-setup.md

* docs: remove docs/nixos-setup.md, consolidate into website docs

Backfill missing details (restart/restartSec in full example,
gateway.pid, 0750 permissions, docker inspect commands) into
the canonical website/docs/getting-started/nix-setup.md and
delete the old standalone file.

* fix(nix): add compression.protect_last_n and target_ratio to config-keys.json

New keys were added to DEFAULT_CONFIG on main, causing the
config-drift check to fail in CI.

* fix(nix): skip checks on aarch64-darwin (onnxruntime wheel missing)

The full Python venv includes onnxruntime (via faster-whisper/STT)
which lacks a compatible uv2nix wheel on aarch64-darwin. Gate all
checks behind stdenv.hostPlatform.isLinux. The package and devShell
still evaluate on macOS.

* fix(nix): skip flake check and build on macOS CI

onnxruntime (transitive dep via faster-whisper) lacks a compatible
uv2nix wheel on aarch64-darwin. Run full checks and build on Linux
only; macOS CI verifies the flake evaluates without building.

* fix(nix): preserve container writable layer across nixos-rebuild

The container identity hash included the entrypoint's Nix store path,
which changes on every nixpkgs update (due to runtimeShell/stdenv
input-addressing). This caused false-positive identity mismatches,
triggering container recreation and losing the persistent writable layer.

- Use stable symlink (current-entrypoint) like current-package already does
- Remove entrypoint from identity hash (only image/volumes/options matter)
- Add GC root for entrypoint so nix-collect-garbage doesn't break it
- Remove global HERMES_HOME env var from addToSystemPackages (conflicted
  with interactive CLI use, service already sets its own)

---------
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request May 27, 2026
- Priority: p0 (critical) through p3 (low), default p2
- Search: filter by query substring, status, priority
- Update: edit content/status/priority of any task
- Schema extended with new params and enum values
- Battleship NousResearch#20 reduced from 5 to 3 gaps (~366 total)
verkyyi added a commit to verkyyi/hermes-agent that referenced this pull request May 27, 2026
Keeps the inventory current after porting the add_notify_sub upsert
(c653c88) from the retired agent-driven-kanban-orchestration branch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
verkyyi added a commit to verkyyi/hermes-agent that referenced this pull request May 28, 2026
…traction

The run.py / kanban_db.py conflict surface (~622 / ~108 modified lines) is
dominated by fork changes woven into upstream control flow (conversation-lock
wrap + public-progress loop in run.py; expected_run_id UPDATE scoping +
crash-detection fingerprinting + complete_task truncation removal in kanban_db).
Extracting these would enlarge diffs and risk behavior in the kanban state
machine — left in place, resolve at merge time under NousResearch#5/NousResearch#20 test cover.

Only safe reduction: 3 entirely fork-added GatewayRunner methods moved into
gateway/gateway_forklocal.ForkLocalGatewayMixin (run.py added column 657→631;
conflict surface 622 unchanged). Behavior-preserving (gateway suite parity,
ruff clean). Tier-1 NousResearch#10 declined as net-negative.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…de (NousResearch#20)

* feat: nix flake, uv2nix build, dev shell and home manager

* fixed nix run, updated docs for setup

* feat(nix): NixOS module with persistent container mode, managed guards, checks

- Replace homeModules.nix with nixosModules.nix (two deployment modes)
- Mode A (native): hardened systemd service with ProtectSystem=strict
- Mode B (container): persistent Ubuntu container with /nix/store bind-mount,
  identity-hash-based recreation, GC root protection, symlink-based updates
- Add HERMES_MANAGED guards blocking CLI config mutation (config set, setup,
  gateway install/uninstall) when running under NixOS module
- Add nix/checks.nix with build-time verification (binary, CLI, managed guard)
- Remove container.nix (no Nix-built OCI image; pulls ubuntu:24.04 at runtime)
- Simplify packages.nix (drop fetchFromGitHub submodules, PYTHONPATH wrappers)
- Rewrite docs/nixos-setup.md with full options reference, container
  architecture, secrets management, and troubleshooting guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Update config.py

* feat(nix): add CI workflow and enhanced build checks
- GitHub Actions workflow for nix flake check + build on linux/macOS
- Entry point sync check to catch pyproject.toml drift
- Expanded managed-guard check to cover config edit
- Wrap hermes-acp binary in Nix package
- Fix Path type mismatch in is_managed()

* Update MCP server package name; bundled skills support

* fix reading .env. instead have container user a common mounted .env file

* feat(nix): container entrypoint with privilege drop and sudo provisioning

Container was running as non-root via --user, which broke apt/pip installs
and caused crashes when $HOME didn't exist. Replace --user with a Nix-built
entrypoint script that provisions the hermes user, sudo (NOPASSWD), and
/home/hermes inside the container on first boot, then drops privileges via
setpriv. Writable layer persists so setup only runs once.

Also expands MCP server options to support HTTP transport and sampling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix group and user creation in container mode

* feat(nix): persistent /home/hermes and MESSAGING_CWD in container mode

Container mode now bind-mounts ${stateDir}/home to /home/hermes so the
agent's home directory survives container recreation. Previously it lived
in the writable layer and was lost on image/volume/options changes.

Also passes MESSAGING_CWD to the container so the agent finds its
workspace and documents, matching native mode behavior.

Other changes:
- Extract containerDataDir/containerHomeDir bindings (no more magic strings)
- Fix entrypoint chown to run unconditionally (volume mounts always exist)
- Add schema field to container identity hash for auto-recreation
- Add idempotency test (Scenario G) to config-roundtrip check

* docs: add Nix & NixOS setup guide to docs site

Add comprehensive Nix documentation to the Docusaurus site at
website/docs/getting-started/nix-setup.md, covering nix run/profile
install, NixOS module (native + container modes), declarative settings,
secrets management, MCP servers, managed mode, container architecture,
dev shell, flake checks, and full options reference.

- Register nix-setup in sidebar after installation page
- Add Nix callout tip to installation.md linking to new guide
- Add canonical version pointer in docs/nixos-setup.md

* docs: remove docs/nixos-setup.md, consolidate into website docs

Backfill missing details (restart/restartSec in full example,
gateway.pid, 0750 permissions, docker inspect commands) into
the canonical website/docs/getting-started/nix-setup.md and
delete the old standalone file.

* fix(nix): add compression.protect_last_n and target_ratio to config-keys.json

New keys were added to DEFAULT_CONFIG on main, causing the
config-drift check to fail in CI.

* fix(nix): skip checks on aarch64-darwin (onnxruntime wheel missing)

The full Python venv includes onnxruntime (via faster-whisper/STT)
which lacks a compatible uv2nix wheel on aarch64-darwin. Gate all
checks behind stdenv.hostPlatform.isLinux. The package and devShell
still evaluate on macOS.

* fix(nix): skip flake check and build on macOS CI

onnxruntime (transitive dep via faster-whisper) lacks a compatible
uv2nix wheel on aarch64-darwin. Run full checks and build on Linux
only; macOS CI verifies the flake evaluates without building.

* fix(nix): preserve container writable layer across nixos-rebuild

The container identity hash included the entrypoint's Nix store path,
which changes on every nixpkgs update (due to runtimeShell/stdenv
input-addressing). This caused false-positive identity mismatches,
triggering container recreation and losing the persistent writable layer.

- Use stable symlink (current-entrypoint) like current-package already does
- Remove entrypoint from identity hash (only image/volumes/options matter)
- Add GC root for entrypoint so nix-collect-garbage doesn't break it
- Remove global HERMES_HOME env var from addToSystemPackages (conflicted
  with interactive CLI use, service already sets its own)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
difeizheng pushed a commit to difeizheng/zdf-hermes-agent that referenced this pull request Jun 3, 2026
Fixes 12 remaining MEDIUM issues from the deep audit (19 total, 7 fixed in Round 12):

design_agent:
- NousResearch#15: add asyncio.wait_for(300s) around LLM API call to prevent infinite hangs
- NousResearch#17: replace 2x hardcoded 'claude-opus-4-8' with shared DEFAULT_MODEL constant

qa_agent / validate_agent:
- NousResearch#20,NousResearch#22,NousResearch#23: already fixed in Round 12 (verified — dynamic timeout/threshold values used)

memory.py:
- NousResearch#24: frontmatter parser uses regex r'^---$' instead of str.split('---',2),
  preventing false splits on content containing '---' (SQL, markdown tables)
- NousResearch#25: parse and preserve 'description' field from frontmatter in metadata,
  fixing write→load roundtrip data loss

profiles.py:
- NousResearch#26: ProfileConfig now frozen=True (immutable dataclass per coding standards)

deploy_agent:
- NousResearch#31: replace 2x sync subprocess.run with asyncio.create_subprocess_exec
- fix 5x .decode() → .decode('utf-8', errors='replace') for Windows CJK safety
- remove unused import subprocess

db.py:
- NousResearch#27: add class docstring explaining RLock + _unlocked pattern
- NousResearch#28: FK constraints already in DDL (verified PRAGMA foreign_keys=ON active)
- NousResearch#29: add _ensure_connection() with PRAGMA integrity_check(1) + auto-reconnect
       on 4 critical methods (create_task, get_task, claim_task, submit_result)
- extract _create_connection() static method for reuse by reconnect

Tests: 79 passed, 0 failed
dizhaky added a commit to dizhaky/hermes-agent that referenced this pull request Jun 4, 2026
- CVE-2026-44432: Decompression-bomb safeguards bypassed in streaming API
- CVE-2026-44431: Sensitive headers forwarded across origins in redirects

Fixes Dependabot alerts NousResearch#21, NousResearch#20
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…de (NousResearch#20)

* feat: nix flake, uv2nix build, dev shell and home manager

* fixed nix run, updated docs for setup

* feat(nix): NixOS module with persistent container mode, managed guards, checks

- Replace homeModules.nix with nixosModules.nix (two deployment modes)
- Mode A (native): hardened systemd service with ProtectSystem=strict
- Mode B (container): persistent Ubuntu container with /nix/store bind-mount,
  identity-hash-based recreation, GC root protection, symlink-based updates
- Add HERMES_MANAGED guards blocking CLI config mutation (config set, setup,
  gateway install/uninstall) when running under NixOS module
- Add nix/checks.nix with build-time verification (binary, CLI, managed guard)
- Remove container.nix (no Nix-built OCI image; pulls ubuntu:24.04 at runtime)
- Simplify packages.nix (drop fetchFromGitHub submodules, PYTHONPATH wrappers)
- Rewrite docs/nixos-setup.md with full options reference, container
  architecture, secrets management, and troubleshooting guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Update config.py

* feat(nix): add CI workflow and enhanced build checks
- GitHub Actions workflow for nix flake check + build on linux/macOS
- Entry point sync check to catch pyproject.toml drift
- Expanded managed-guard check to cover config edit
- Wrap hermes-acp binary in Nix package
- Fix Path type mismatch in is_managed()

* Update MCP server package name; bundled skills support

* fix reading .env. instead have container user a common mounted .env file

* feat(nix): container entrypoint with privilege drop and sudo provisioning

Container was running as non-root via --user, which broke apt/pip installs
and caused crashes when $HOME didn't exist. Replace --user with a Nix-built
entrypoint script that provisions the hermes user, sudo (NOPASSWD), and
/home/hermes inside the container on first boot, then drops privileges via
setpriv. Writable layer persists so setup only runs once.

Also expands MCP server options to support HTTP transport and sampling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix group and user creation in container mode

* feat(nix): persistent /home/hermes and MESSAGING_CWD in container mode

Container mode now bind-mounts ${stateDir}/home to /home/hermes so the
agent's home directory survives container recreation. Previously it lived
in the writable layer and was lost on image/volume/options changes.

Also passes MESSAGING_CWD to the container so the agent finds its
workspace and documents, matching native mode behavior.

Other changes:
- Extract containerDataDir/containerHomeDir bindings (no more magic strings)
- Fix entrypoint chown to run unconditionally (volume mounts always exist)
- Add schema field to container identity hash for auto-recreation
- Add idempotency test (Scenario G) to config-roundtrip check

* docs: add Nix & NixOS setup guide to docs site

Add comprehensive Nix documentation to the Docusaurus site at
website/docs/getting-started/nix-setup.md, covering nix run/profile
install, NixOS module (native + container modes), declarative settings,
secrets management, MCP servers, managed mode, container architecture,
dev shell, flake checks, and full options reference.

- Register nix-setup in sidebar after installation page
- Add Nix callout tip to installation.md linking to new guide
- Add canonical version pointer in docs/nixos-setup.md

* docs: remove docs/nixos-setup.md, consolidate into website docs

Backfill missing details (restart/restartSec in full example,
gateway.pid, 0750 permissions, docker inspect commands) into
the canonical website/docs/getting-started/nix-setup.md and
delete the old standalone file.

* fix(nix): add compression.protect_last_n and target_ratio to config-keys.json

New keys were added to DEFAULT_CONFIG on main, causing the
config-drift check to fail in CI.

* fix(nix): skip checks on aarch64-darwin (onnxruntime wheel missing)

The full Python venv includes onnxruntime (via faster-whisper/STT)
which lacks a compatible uv2nix wheel on aarch64-darwin. Gate all
checks behind stdenv.hostPlatform.isLinux. The package and devShell
still evaluate on macOS.

* fix(nix): skip flake check and build on macOS CI

onnxruntime (transitive dep via faster-whisper) lacks a compatible
uv2nix wheel on aarch64-darwin. Run full checks and build on Linux
only; macOS CI verifies the flake evaluates without building.

* fix(nix): preserve container writable layer across nixos-rebuild

The container identity hash included the entrypoint's Nix store path,
which changes on every nixpkgs update (due to runtimeShell/stdenv
input-addressing). This caused false-positive identity mismatches,
triggering container recreation and losing the persistent writable layer.

- Use stable symlink (current-entrypoint) like current-package already does
- Remove entrypoint from identity hash (only image/volumes/options matter)
- Add GC root for entrypoint so nix-collect-garbage doesn't break it
- Remove global HERMES_HOME env var from addToSystemPackages (conflicted
  with interactive CLI use, service already sets its own)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants