Skip to content

opencode binary on macOS arm64 is 0 byte large when building from nix flake #4575

Closed

Description

@Mic92

Description

I made the same observation in nix-ai-tools, which is why I switched to bundeling the javascript. There is something off when running bun install inside the nix sandbox. The same commands work fine outside the sandbox.

$ nix build github:sst/opencode
$ ./result/bin/opencode --version
$ ls -al ./result/bin/.opencode-wrapped
.r-xr-xr-x@ 0 root 55 years  ./result/bin/.opencode-wrapped
$ du -sh ./result/bin/.opencode-wrapped
0B .opencode-wrapped

cc @Alb-O who authored the original build.

I might re-use your node normalization though to have reproducible hashes.

OpenCode version

d16c8c9

Steps to reproduce

see above

Operating System

macOS m4

Terminal

not important

Activity

  1. changed the title [-]flake on macOS arm64 is 0 byte large[/-] [+]opencode binary on macOS arm64 is 0 byte large when building from flake[/+] on Nov 21, 2025
  2. changed the title [-]opencode binary on macOS arm64 is 0 byte large when building from flake[/-] [+]opencode binary on macOS arm64 is 0 byte large when building from nix flake[/+] on Nov 21, 2025
  3. Alb-O commented on Nov 21, 2025

    @Alb-O
    Contributor

    I believe this is an unresolved, upstream bug with bun, see oven-sh/bun#24645

    Not sure what we can do here except pester the bun developers

  4. Mic92 commented on Nov 21, 2025

    @Mic92
    Author
  5. Alb-O commented on Nov 21, 2025

    @Alb-O
    Contributor

    Nice, I'll have a look at this tomorrow and see if I can get it merged here, thanks

  6. Alb-O commented on Nov 22, 2025

    @Alb-O
    Contributor

    @Mic92 Before I open a PR, would you be so kind as to test run this? github:Alb-O/opencode/nix-support

  7. bogorad commented on Nov 22, 2025

    @bogorad

    quick'n'dirty solution for now, I really hope we get to the bottom of the bun issues.

    alias oc=''nix run github:bogorad/oc-bin-flake --refresh''

    https://github.com/bogorad/oc-bin-flake

  8. Mic92 commented on Nov 23, 2025

    @Mic92
    Author

    quick'n'dirty solution for now, I really hope we get to the bottom of the bun issues.

    alias oc=''nix run github:bogorad/oc-bin-flake --refresh''

    https://github.com/bogorad/oc-bin-flake

    I had actually issues with patchelf on arm64-linux for this packages, which is why I went through the hassel of building from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions