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

Closed
opened 2026-02-16 17:38:15 -05:00 by yindo · 6 comments
Owner

Originally created by @Mic92 on GitHub (Nov 21, 2025).

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

d16c8c9f0f

Steps to reproduce

see above

Operating System

macOS m4

Terminal

not important

Originally created by @Mic92 on GitHub (Nov 21, 2025). ### 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 d16c8c9f0fda4bdd3b41c3cf9fca84daa3262e9a ### Steps to reproduce see above ### Operating System macOS m4 ### Terminal not important
yindo added the bugnix labels 2026-02-16 17:38:15 -05:00
yindo closed this issue 2026-02-16 17:38:15 -05:00
Author
Owner

@Alb-O commented on GitHub (Nov 21, 2025):

I believe this is an unresolved, upstream bug with bun, see https://github.com/oven-sh/bun/issues/24645

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

@Alb-O commented on GitHub (Nov 21, 2025): I believe this is an unresolved, upstream bug with bun, see https://github.com/oven-sh/bun/issues/24645 Not sure what we can do here except pester the bun developers
Author
Owner
@Mic92 commented on GitHub (Nov 21, 2025): This approach works for me: https://github.com/numtide/nix-ai-tools/pull/1032 now: https://github.com/numtide/nix-ai-tools/blob/main/packages/opencode/package.nix
Author
Owner

@Alb-O commented on GitHub (Nov 21, 2025):

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

@Alb-O commented on GitHub (Nov 21, 2025): Nice, I'll have a look at this tomorrow and see if I can get it merged here, thanks
Author
Owner

@Alb-O commented on GitHub (Nov 21, 2025):

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

@Alb-O commented on GitHub (Nov 21, 2025): @Mic92 Before I open a PR, would you be so kind as to test run this? `github:Alb-O/opencode/nix-support`
Author
Owner

@bogorad commented on GitHub (Nov 22, 2025):

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

@bogorad commented on GitHub (Nov 22, 2025): 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
Author
Owner

@Mic92 commented on GitHub (Nov 23, 2025):

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.

@Mic92 commented on GitHub (Nov 23, 2025): > 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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3018