Skip to content

Create /etc/static/shells symlink for NixOS hosts - #5

Merged
francoism90 merged 1 commit into
masterfrom
nixos-etc-static-shells
Sep 10, 2026
Merged

francoism90 merged 1 commit into
masterfrom
nixos-etc-static-shells

Conversation

@francoism90

Copy link
Copy Markdown
Owner

Summary

  • On NixOS, the host's /etc/shells is a symlink to /etc/static/shells. This manifest already symlinks the sandbox's /etc/shells to /var/run/host/etc/shells, but that second hop resolves against the sandbox's own root (not /var/run/host), and the sandbox has no /etc/static/shells — so it 404s with ENOENT: no such file or directory, open '/etc/shells', breaking terminal.integrated.defaultProfile.linux detection.
  • Fix: symlink /etc/static/shells the same way, conditional on it existing on the host, so non-NixOS hosts are unaffected.

Cherry-picked from flathub/com.visualstudio.code#428, but using the fix a reviewer suggested there (a conditional symlink to the host's real file) instead of the PR's own approach (an unconditional hardcoded sh/bash fallback written for every user, NixOS or not) — likely why that PR was never merged despite being open since 2023.

Test plan

  • On a NixOS host, confirm /etc/shells resolves inside the sandbox and the integrated terminal's bash profile works
  • On a non-NixOS host, confirm /etc/static/shells is not created (the [ -e /var/run/host/etc/static/shells ] check should be false)

On NixOS, the host's /etc/shells is itself a symlink to
/etc/static/shells. When this manifest's own /etc/shells is symlinked
to /var/run/host/etc/shells, resolving that second hop fails with
ENOENT: absolute symlink targets resolve against the sandbox's own
root, not /var/run/host, and the sandbox has no /etc/static/shells.
Mirroring the existing /etc/shells symlink pattern for /etc/static/shells
fixes it, letting VS Code's shell-profile detection work again.

Cherry-picked from flathub#428, using the fix a
reviewer suggested there (a conditional symlink to the host's real
file) instead of the PR's own approach (an unconditional hardcoded
sh/bash fallback for every user, NixOS or not), which is why that PR
was never merged despite being open since 2023.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@francoism90
francoism90 merged commit 9ad371f into master Sep 10, 2026
1 check passed
@francoism90
francoism90 deleted the nixos-etc-static-shells branch September 10, 2026 14:00
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