Repository navigation
Commit 1463efe
committed
Fix opencode WSL2 segfault in place instead of pinning stable
opencode built by nixpkgs segfaults at startup under WSL2 (nixpkgs' bun
produces compiled binaries whose ELF layout WSL2's loader rejects —
anomalyco/opencode#26846, NixOS/nixpkgs#520383). The old workaround
pinned opencode to nixos-25.11, which is stuck at 1.1.14 and predates
the --auto flag (added in 1.17.12).
Re-running patchelf --set-interpreter on the finished binary rewrites
the ELF cleanly and fixes the load, so post-process the cache-fetched
unstable package instead: copy it, re-patchelf .opencode-wrapped, and
retarget the compiled C wrapper's baked-in store path via equal-length
substitution (same derivation name, so same path length). A source
rebuild via overrideAttrs was tried first but cannot succeed on WSL2:
opencode's build script smoke-tests the fresh binary, which segfaults
before any fixup runs — and it would forfeit the binary cache anyway.
With the pin gone, the nixpkgs-stable input existed only for it, so
remove it from the flake as well.
Verified on this WSL2 host: the overlaid package prints its version
and lists --auto in its help, where the unpatched unstable binary
segfaults (exit 139) on --version.1 parent 8be3489 commit 1463efe
3 files changed
Lines changed: 27 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | 8 | | |
13 | 9 | | |
14 | 10 | | |
| |||
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | | - | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
| |||
36 | 31 | | |
37 | 32 | | |
38 | 33 | | |
39 | | - | |
40 | 34 | | |
41 | 35 | | |
42 | 36 | | |
| |||
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
51 | | - | |
52 | 45 | | |
53 | 46 | | |
54 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
28 | 49 | | |
29 | 50 | | |
30 | 51 | | |
| |||
0 commit comments