-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1142 add nix flake support #1157
base: develop
Are you sure you want to change the base?
1142 add nix flake support #1157
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ |
@lessuselesss love this PR, but there are some weird problems that will cause a NixOS user to fail when building the codebase with nix flakes enabled. For example, I built this on my NixOS machine and we see this error:
We may think...what?! No Way...But how?? The pkgs specifically lists So I did some digging bc Nix can be a pain in the ass at times with weird dependencies errors. So I checked the So this here is the culprit for why a NixOS user will hit this weird error even though we declaratively chose the right node version. |
Hello, Thank you so much for the valuable feedback. I'm excited to contribute and am happy (and was hoping!!) to have someone from the nix community overseeing contributions here! Nice catch on finding the culprit, I'll investigate some workarounds 🙇 |
I don't like the hardcoded versions, maybe another dev can offer a better suggestions on how to get the latest version like |
Thanks for the feedback! I've updated the implementation to automatically detect versions from package.json instead of hardcoding them. The flake now:
This should make it more maintainable and reduce the risk of version mismatches. Alternatively, @HashWarlock would an overlay for nodejs/pnpm be more appropriate nix'ing here? |
- Add Nix flake for reproducible development environment - Auto-detect Node.js and pnpm versions from package.json - Configure development tools (gcc, python3, vips, etc.) - Add shell hook with helpful development commands
72d22cd
to
b7185b6
Compare
I've reset the branch to resolve the merge conflicts and provide a clean implementation. The core functionality remains the same:
The previous discussion and feedback has been incorporated into this cleaner version. |
Probably best to do an overlay bc whenever I run the current How do the tests work in your nix environment? |
I ended up installing eliza on a fresh VM as per the readme, and found similar results to the below (esp. #4) Let me share what I've found from running the tests in the nix environment:
Regarding your question about an overlay - yes, that sounds like a good approach so I've gone ahead and made an attempt. Let me know if you'd like me to focus on any specific area or if you need more details about the test results. |
4cafe97
to
2c78149
Compare
I've installed NixOS and I'm seeing the same printout you were referring to when entering the nix dev environment. For whatever reason nix-darwin wasn't having any issues. Will try to figure out what is what here. |
Can you use nvm to install? This is how they recommend on node website now.
|
- Remove Linux-specific ELF patching on macOS systems - Conditionally include build inputs based on platform - Ensure proper executable permissions for Node.js binaries This fixes the development shell initialization on macOS while maintaining Linux compatibility.
@HashWarlock This approach simplified things greatly, cheers! My NixOS vm isn't working, and won't install (apple hypervisor), so if anyone weigh in on how it's working that would be great. |
Testing now. Will respond back soon with results! Great work :) I ran into this. This problem should not be this hard, but NixOS makes it hard 🥴 . I think there may be a point that having NixOS support can be left to a user running NixOS as a daily driver & add a small statement in the
|
@HashWarlock A bit disappointing, but I suppose those running NixOS as a daily driver are more equipped or ready to deal with such things. Here's what I've tried thus far to get nodejs/pnpm not running off of nixpkgs, by referencing the package.json Derivations - No network access in the sandbox, which was getting us the initial errors you found. Overlays - Couldn't (yet) get it working/enter the development environment because of the dynamic logic. Moved it out of the flake.nix itself and made a solid attempt with nvfetcher (was aiming to have github actions perhaps update the .toml it reference with the url/hashes the flake would need) but I just couldn't seem to produce "pure-ness". NVM Flake - I tried picking up where another project nix-node left off, to implement nvm-likeness. I'd like to get the overlays working but as per your point, it might be "fine enough" for now by addressing NixOS users in the README. I'll go ahead and check your references there, thank you for the support! |
Relates to:
Issue #1142
Risks
Low - This change:
Background
What does this PR do?
Adds Nix Flake support to provide a reproducible development environment with:
What kind of change is this?
Improvements (adds optional development tooling without changing existing functionality)
Documentation changes needed?
My changes require a change to the project documentation.
I will update the local development guide to include:
Testing
Where should a reviewer start?
git clone https://github.com/ai16z/eliza.git cd eliza nix develop
Detailed testing steps
Prerequisites:
Test environment setup:
git clone https://github.com/ai16z/eliza.git cd eliza nix develop
Test build process:
Test clean process:
Discord username
Adam Turner | lessuseless
ar4s_45979