feat: add Nix flake for building from source, fix read-only copyFileSync#1458
Open
flyingleafe wants to merge 3 commits intoruvnet:mainfrom
Open
feat: add Nix flake for building from source, fix read-only copyFileSync#1458flyingleafe wants to merge 3 commits intoruvnet:mainfrom
flyingleafe wants to merge 3 commits intoruvnet:mainfrom
Conversation
Add a Nix flake that builds the CLI from source using buildNpmPackage with Node.js 22, exposing `claude-flow` and `ruflo` binaries. Fix EACCES errors during `init` when the package lives on a read-only filesystem (e.g. Nix store): copyFileSync preserves source permissions, so copied helper/command files were read-only and subsequent overwrites failed. Now every copyFileSync is followed by a chmodSync to ensure the destination is owner-writable. Co-Authored-By: claude-flow <ruv@ruv.net>
Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
flake.nix) that builds the CLI from source usingbuildNpmPackagewith Node.js 22, exposingclaude-flowandruflobinariesEACCESerrors duringinitwhen the package lives on a read-only filesystem (e.g. the Nix store)result) to.gitignoreChanges
flake.nix+flake.lock: Nix flake that builds@claude-flow/clifrom source viabuildNpmPackage, pins Node.js 22, and exposesclaude-flow/rufloexecutables. Includes a dev shell with Node.js + npm.v3/@claude-flow/cli/src/init/executor.ts: After everycopyFileSynccall, runchmodSyncto make the destination owner-writable (0o644for files).copyFileSyncpreserves source permissions, so files copied from a read-only store were not writable — subsequent overwrites failed withEACCES..gitignore: Ignoreresultandresult-*symlinks created bynix build.Motivation
On NixOS (and any Nix-based setup), packages installed via Nix live on a read-only filesystem. This causes two problems:
flake.nixto build the project from source with Nix tooling.initcommand crashes —copyFileSynccopies files with source permissions intact; files from the Nix store are read-only, so any later write to those copies throwsEACCES.Test plan
nix buildproduces a workingclaude-flow/ruflobinarynix developdrops into a shell with Node.js 22 + npmnpx claude-flow initsucceeds on a Nix-installed package (noEACCES)copyFileSync+chmodSyncis a no-op when permissions are already writable)