feat: Add Nix flake and Devbox support for reproducible builds#740
feat: Add Nix flake and Devbox support for reproducible builds#740levonk wants to merge 4 commits into
Conversation
Adds Nix flake support for reproducible development environments: - flake.nix: provides devShell with nodejs_22 - devbox.json: devbox configuration for build/test/run scripts - package-lock.json: tracked for Nix buildNpmPackage compatibility - .gitignore: allow package-lock.json, add Nix result symlinks - README.md: add Nix and Devbox install instructions Note: nix run installable package support is blocked by native binary dependencies in the build toolchain (esbuild, rolldown). The devShell provides a working development environment.
The previous devShell-only approach is now complemented by a working buildNpmPackage derivation: - flake.nix: add buildNpmPackage with npmDepsHash, NPM_CONFIG_IGNORE_SCRIPTS - devbox.json: add git as a required development binary - README.md: update Nix section to show nix run / nix build / nix develop Verified: nix run . -- --version outputs 0.9.24
|
@levonk is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds Nix flake and Devbox configurations ( ChangesNix Flake and Devbox Development Environment
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitignore:
- Around line 22-23: The comment about lock files is contradictory: update the
.gitignore comment so it states that lock files are generally not committed but
make a clear exception that package-lock.json is intentionally tracked for the
Nix buildNpmPackage; reference the existing comment text (the two lines about
"Lock files — never commit" and "NOTE: package-lock.json is tracked because it
is required for Nix buildNpmPackage") and rewrite them into a single unambiguous
sentence clarifying the general rule and the explicit exception for
package-lock.json.
In `@devbox.json`:
- Line 13: The devbox "install" script currently runs plain npm install which
differs from the Nix workflow that enables legacy peer deps; update the
"install" entry in devbox.json (the "install" script key) to run npm install
with the same flag used by Nix, e.g. change the command to include
--legacy-peer-deps so Devbox's dependency resolution matches the Nix workflow.
In `@README.md`:
- Around line 133-138: The quick-start sequence currently shows "devbox shell"
then "devbox run build" which can fail on first run due to missing dependencies;
insert "devbox run install" after the "devbox shell" step and before "devbox run
build" (and add a brief note that this installs node_modules for first-time
setups) so first-time builds succeed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8ef83a7b-fa99-4849-bd49-bedce4ef276d
⛔ Files ignored due to path filters (2)
flake.lockis excluded by!**/*.lockpackage-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
.gitignoreREADME.mddevbox.jsonflake.nix
- .gitignore: rewrite contradictory lockfile comment - devbox.json: add --legacy-peer-deps to install script and on_create hook - README.md: add devbox run install step to quick-start
|
|
||
| # Build locally | ||
| nix build github:levonk/agentmemory | ||
|
|
There was a problem hiding this comment.
you have lot of hard-coded things here
| @@ -0,0 +1,61 @@ | |||
| { | |||
| "nodes": { | |||
What
Adds Nix flake support and Devbox configuration for reproducible builds and development environments.
Why
Nix users cannot currently build or run
agentmemoryfrom source without manually managing Node.js and npm outside their declarative configuration. This PR provides a hermetic, reproducible path for both development (nix develop,devbox shell) and distribution (nix run,nix build).Changes
flake.nix — Nix flake with:
packages.<system>.default:buildNpmPackagederivationapps.<system>.default: runnableagentmemoryCLIdevShells.default: development shell withnodejs_22overlays.default: for composing into other flakeschecks.build: CI verification targetdevbox.json — Devbox environment with
nodejs_22,npm, andgit.gitignore — Track
package-lock.json(required for NixbuildNpmPackage), ignore/resultsymlinksREADME.md — Document
nix run,nix build, andnix developworkflowsVerification
Related Issue
Fixes #730
Summary by CodeRabbit
Documentation
Chores