Skip to content

Nix package: missing fastapi + web dashboard frontend not built #9305

@lvnilesh

Description

@lvnilesh

Summary

The Nix flake package (nix/packages.nix) has two bugs that completely break hermes dashboard:

  1. fastapi missing from the virtualenv — uv2nix resolves hermes-agent[all] (which includes [web]), but fastapi is silently dropped from the final venv. Its dependencies (starlette, uvicorn, pydantic) are present, but fastapi itself is not. Running hermes dashboard fails immediately:

    SystemExit: Web UI requires fastapi and uvicorn.
    Run 'hermes web' to auto-install, or: pip install hermes-agent[web]
    
  2. web_dist/ not built or bundledpyproject.toml declares hermes_cli = ["web_dist/**/*"] as package data, but the source tree doesn't contain hermes_cli/web_dist/ (it requires cd web && npm run build to generate). The Nix package (nix/packages.nix) doesn't run this build step, so even after fixing the fastapi import, the dashboard returns:

    {"error":"Frontend not built. Run: cd web && npm run build"}

Environment

  • hermes-agent v0.9.0 (commit 78fa758)
  • NixOS unstable (nixpkgs rev 4c1018d)
  • Python 3.11.15 (from uv2nix venv)

Workaround

We're working around both issues in our NixOS config:

fastapi: Fetch the wheel directly and inject via PYTHONPATH:

fastapi-wheel = pkgs.fetchurl {
  url = "https://files.pythonhosted.org/packages/.../fastapi-0.133.1-py3-none-any.whl";
  hash = "sha256-ZY80ujNGBbFhemWt8upkYZAb25rzowgNY/95Hs99wuI=";
};
fastapi-pkg = pkgs.runCommand "fastapi-0.133.1" {} ''
  mkdir -p $out/lib/python3.11/site-packages
  ${pkgs.unzip}/bin/unzip ${fastapi-wheel} -d $out/lib/python3.11/site-packages
'';

web_dist: Build the frontend with buildNpmPackage and inject into a PYTHONPATH overlay that shadows hermes_cli:

hermes-web-dist = pkgs.buildNpmPackage {
  pname = "hermes-web-dist";
  version = "0.9.0";
  src = "${hermesSrc}/web";
  npmDepsHash = "sha256-kBq8QpUBmvfinqjGXT81TatWslql/uZN6Fd7b/We4VI=";
  buildPhase = ''npm run build -- --outDir $out'';
  dontInstall = true;
};

Then we create an overlay derivation that copies hermes_cli from the venv and symlinks web_dist + fastapi into it, and prepend it via --prefix PYTHONPATH on the hermes wrapper.

Suggested fix

  1. fastapi: Debug why uv2nix drops fastapi from the [all] extra resolution in nix/python.nix. May need an explicit override similar to the existing aarch64-darwin overrides.

  2. web_dist: Add a buildNpmPackage step to nix/packages.nix that runs cd web && npm run build and copies the output into hermes_cli/web_dist/ in the final package. The vite.config.ts already has outDir: "../hermes_cli/web_dist" configured.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions