Conversation
libffi.so.7 was garbage-collected from the nix store. nix, bun, and opencode all use the nix glibc linker which only searches nix store paths - so they all failed with 'libffi.so.7: cannot open shared object file', making opencode (and swarm) completely non-functional. Fix: create ~/.local/share/nix-compat/ with a single symlink to the system /usr/lib/libffi.so.7. That dir contains only libffi.so.7, so no other system libs bleed in and cause ABI crashes. - env.fish: set LD_LIBRARY_PATH to the shim dir on shell startup - swarm.ts: inject LD_LIBRARY_PATH into PTY env and bashSpawn env - opencode.yml: create the shim dir/symlink, pass LD_LIBRARY_PATH to the nix shell task - opencode-swarm.yml: same env fix for bun install task - nixgl.yml: same env fix for nixGL install task Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
Addresses Nix runtime breakage caused by libffi.so.7 being garbage-collected from the Nix store by introducing a minimal compatibility shim (~/.local/share/nix-compat/libffi.so.7) and ensuring relevant tooling (OpenCode, swarm, bun, nixGL) can find it via LD_LIBRARY_PATH.
Changes:
- Add Ansible provisioning for the
nix-compatshim and propagateLD_LIBRARY_PATHto Nix-driven install tasks. - Inject
LD_LIBRARY_PATHinto the OpenCode swarm plugin process environments so the swarm CLI works even when not launched from an interactive Fish session. - Update Fish startup env to prepend the shim directory to
LD_LIBRARY_PATHwhen present.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| roles/dotfiles/tasks/opencode.yml | Creates the nix-compat shim and sets LD_LIBRARY_PATH during opencode install. |
| roles/dotfiles/tasks/opencode-swarm.yml | Sets LD_LIBRARY_PATH for bun install used by the swarm CLI runtime. |
| roles/dotfiles/tasks/nixgl.yml | Sets LD_LIBRARY_PATH for nixGL install. |
| roles/dotfiles/files/opencode/plugin/swarm.ts | Injects LD_LIBRARY_PATH into PTY and spawn env to keep swarm functional outside interactive shells. |
| roles/dotfiles/files/fish/conf.d/env.fish | Prepends ~/.local/share/nix-compat to LD_LIBRARY_PATH on shell startup when available. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+13
to
+17
| - name: Symlink system libffi.so.7 into nix compat shim | ||
| ansible.builtin.file: | ||
| src: /usr/lib/libffi.so.7 | ||
| dest: "{{ user_home }}/.local/share/nix-compat/libffi.so.7" | ||
| state: link |
Comment on lines
+39
to
+40
| environment: | ||
| LD_LIBRARY_PATH: "{{ user_home }}/.local/share/nix-compat" |
Comment on lines
+19
to
+20
| environment: | ||
| LD_LIBRARY_PATH: "{{ user_home }}/.local/share/nix-compat" |
Comment on lines
+619
to
+621
| // libffi.so.7 was GC'd from the nix store; shim dir contains only that one symlink | ||
| // so it can't pollute other nix-linked libs with incompatible system versions. | ||
| LD_LIBRARY_PATH: `/home/me/.local/share/nix-compat:${process.env.LD_LIBRARY_PATH || ""}`, |
| env: { | ||
| ...process.env, | ||
| PATH: `/home/me/.nix-profile/bin:/usr/bin:/usr/local/bin:${process.env.PATH || ""}`, | ||
| LD_LIBRARY_PATH: `/home/me/.local/share/nix-compat:${process.env.LD_LIBRARY_PATH || ""}`, |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libffi.so.7was garbage-collected from the nix store.nix,bun, andopencodeall use the nix glibc linker which only searches nix store paths — so they all failed silently withlibffi.so.7: cannot open shared object file, making opencode (and swarm) completely non-functional.Root cause: nix store GC removed the
libffi-3.3.xderivation (which provides.so.7). The nix store now only haslibffi-3.4/3.5.x(.so.8). The nix glibc linker doesn't fall back to/usr/lib, so it can't find the file even though it exists there.Fix: create
~/.local/share/nix-compat/with a single symlink to the system/usr/lib/libffi.so.7. That directory contains onlylibffi.so.7, so no other system libs can bleed in and cause ABI crashes.env.fish: setLD_LIBRARY_PATHto the shim dir on shell startupswarm.ts: injectLD_LIBRARY_PATHinto PTY env andbashSpawnenv so the swarm CLI works even when the env isn't inherited from an interactive fish sessionopencode.yml: create the shim dir/symlink as a prerequisite, addLD_LIBRARY_PATHto the nix shell taskopencode-swarm.yml: same env fix for the bun install tasknixgl.yml: same env fix for the nixGL install taskVerified:
swarm tool swarmmail_healthreturns{"success":true,"data":{"healthy":true,...}}.opencode --versionandbun --versionboth work with the shim in place.