Skip to content

feat(nix): flake has no UI-embedded package — nix run/shell can't serve --ui #1088

Description

@mipmip

What problem does this solve?

The flake's only package (default) builds the cbm Makefile target, which links src/ui/embedded_stub.c (no assets). So a binary from nix run/nix shell/nix build has no embedded UI, and codebase-memory-mcp --ui=true refuses to start:

--ui requested, but this binary was built without the embedded UI, so the HTTP server will not start.

There's no Nix-native way to get the UI-embedded server — the cbm-with-ui target runs npm ci && npm run build, which needs network access and so can't run in the build sandbox as wired today. (Distinct from #705, which is about build.sh/make failing in the dev shell on macOS.)

Proposed solution

Add two flake outputs alongside default:

  • graph-ui — the React frontend built with buildNpmPackage (deps fetched offline from the pinned graph-ui/package-lock.json via npmDepsHash).
  • codebase-memory-mcp-ui — the server with those assets embedded: drop the prebuilt dist/ into graph-ui/dist, run scripts/embed-frontend.sh directly, then make cbm-with-ui with frontend/embed marked up-to-date (-o) so npm never runs in the sandbox.

Then nix run .#codebase-memory-mcp-ui -- --ui=true serves the UI. Also document both packages in the README. I have this working locally (verified /, JS, and CSS all serve 200 on x86_64-linux) and would like to open a PR.

Alternatives considered

  • Fetch npm deps in a fixed-output derivation by hand — buildNpmPackage already does this and is the idiomatic choice.
  • Leave Nix UI-less and point users at scripts/build.sh --with-ui — works, but Nix users reasonably expect nix run to produce a functioning binary.

Confirmations

  • I searched existing issues and this is not a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority/normalStandard review queue; useful PR with ordinary maintainer urgency.ux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions