Skip to content

feat: add Nix flake for building from source, fix read-only copyFileSync#1458

Open
flyingleafe wants to merge 3 commits intoruvnet:mainfrom
flyingleafe:feat/nix-flake-support
Open

feat: add Nix flake for building from source, fix read-only copyFileSync#1458
flyingleafe wants to merge 3 commits intoruvnet:mainfrom
flyingleafe:feat/nix-flake-support

Conversation

@flyingleafe
Copy link
Copy Markdown

Summary

  • Add a Nix flake (flake.nix) 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. the Nix store)
  • Add Nix build output (result) to .gitignore

Changes

  • flake.nix + flake.lock: Nix flake that builds @claude-flow/cli from source via buildNpmPackage, pins Node.js 22, and exposes claude-flow / ruflo executables. Includes a dev shell with Node.js + npm.
  • v3/@claude-flow/cli/src/init/executor.ts: After every copyFileSync call, run chmodSync to make the destination owner-writable (0o644 for files). copyFileSync preserves source permissions, so files copied from a read-only store were not writable — subsequent overwrites failed with EACCES.
  • .gitignore: Ignore result and result-* symlinks created by nix build.

Motivation

On NixOS (and any Nix-based setup), packages installed via Nix live on a read-only filesystem. This causes two problems:

  1. No way to build/install natively — there was no flake.nix to build the project from source with Nix tooling.
  2. init command crashescopyFileSync copies files with source permissions intact; files from the Nix store are read-only, so any later write to those copies throws EACCES.

Test plan

  • nix build produces a working claude-flow / ruflo binary
  • nix develop drops into a shell with Node.js 22 + npm
  • npx claude-flow init succeeds on a Nix-installed package (no EACCES)
  • No regression on non-Nix systems (copyFileSync + chmodSync is a no-op when permissions are already writable)

flyingleafe and others added 3 commits March 27, 2026 01:26
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant