Skip to content

Switch to beads_rust, remove Go-based beads#92

Open
javdl wants to merge 1 commit intomainfrom
add-beads-rust
Open

Switch to beads_rust, remove Go-based beads#92
javdl wants to merge 1 commit intomainfrom
add-beads-rust

Conversation

@javdl
Copy link
Contributor

@javdl javdl commented Feb 24, 2026

Summary

  • Replace Go-based beads (bd) with Rust rewrite (br v0.1.19) from beads_rust
  • Remove go dependency (only needed for old beads)
  • Prebuilt binaries for x86_64-linux, x86_64-darwin, aarch64-darwin

Test plan

  • nix develop --command br --version returns br 0.1.19

🤖 Generated with Claude Code

Replace Go-based beads (bd) with Rust rewrite (br v0.1.19) from beads_rust.
Prebuilt binaries for x86_64-linux, x86_64-darwin, aarch64-darwin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link

claude bot commented Feb 24, 2026

Code Review: Switch to beads_rust (br)

Good direction overall — removing the Go runtime dependency simplifies the dev environment. A few issues to address before merging:


Bugs / Will Likely Break

1. Missing autoPatchelfHook for the Linux binary

The pre-built Linux binary (br-v0.1.19-linux_amd64.tar.gz) is almost certainly dynamically linked against glibc/libgcc at hardcoded paths. On Nix/NixOS these paths don't exist, so the binary will fail to execute with a "No such file or directory" error.

Fix by adding autoPatchelfHook and the required runtime libraries:

beads-rust = pkgs.stdenv.mkDerivation {
  pname = "beads-rust";
  version = beadsRustVersion;
  src = pkgs.fetchurl { ... };
  nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [
    pkgs.autoPatchelfHook
  ];
  buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [
    pkgs.stdenv.cc.cc.lib  # libgcc_s, libstdc++
  ];
  ...
};

This is the most critical issue — the Linux target will fail without this.

2. No aarch64-linux support — attribute error on ARM Linux

beadsRustTargets.${system} and beadsRustHashes.${system} will throw an error if system is aarch64-linux. Since the derivation is evaluated for all systems via genAttrs allSystems, this will fail on any ARM Linux host.

If aarch64-linux is intentionally unsupported, guard against it:

devShells = nixpkgs.lib.genAttrs
  (builtins.filter (s: beadsRustHashes ? ${s}) allSystems)
  (system: ...);

Or add meta.platforms to the derivation so Nix marks it broken on unsupported systems.


Code Quality

3. forAllSystems helper is now dead code

forAllSystems is still defined at the top of the file but is no longer used — devShells now calls nixpkgs.lib.genAttrs allSystems directly. Remove it or use it consistently.

4. Shell hook lacks error handling

The old shellHook had a graceful fallback. The new one will emit a raw error if br fails:

# Current — will show command-not-found on failure
echo "  Beads:       $(br --version)"

# Safer
echo "  Beads:       $(br --version 2>/dev/null || echo 'br not available')"

Documentation

5. CLAUDE.md still refers to bd commands throughout

The project instructions reference bd everywhere (bd init, bd create, bd list, bd ready, bd show, bd update, bd close, bd sync). These should be updated to the equivalent br subcommands so AI agents and contributors use the correct binary.


Minor / Informational

6. Consider pkgs.fetchzip over fetchurl + sourceRoot = "."

pkgs.fetchzip unpacks archives automatically and is more idiomatic for .tar.gz archives:

src = pkgs.fetchzip {
  url = "...";
  hash = "...";
  stripRoot = false;
};

Summary: The Linux binary will almost certainly fail without autoPatchelfHook, and the missing aarch64-linux guard will cause a Nix evaluation error on ARM Linux hosts. The dead forAllSystems helper and stale CLAUDE.md references are lower priority but worth cleaning up.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da84104c3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +46 to +47
url = "https://github.com/Dicklesworthstone/beads_rust/releases/download/v${beadsRustVersion}/br-v${beadsRustVersion}-${beadsRustTargets.${system}}.tar.gz";
hash = beadsRustHashes.${system};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add aarch64-linux mapping for beads-rust download

allSystems still includes aarch64-linux, but beadsRustTargets and beadsRustHashes do not define that key while the download URL and hash are indexed with ${system} directly. When an ARM Linux user evaluates devShells.aarch64-linux.default, Nix will fail with a missing attribute error, so nix develop is broken on a platform this flake claims to support.

Useful? React with 👍 / 👎.

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