From 74fc31e6ccbbc56b65c9341bb858d4ba82b1d332 Mon Sep 17 00:00:00 2001 From: francoism90 Date: Thu, 10 Sep 2026 15:59:25 +0200 Subject: [PATCH] Create /etc/static/shells symlink for NixOS hosts 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/com.visualstudio.code#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 --- code.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code.sh b/code.sh index c449052..3eb177a 100755 --- a/code.sh +++ b/code.sh @@ -60,6 +60,13 @@ for i in "${SDK[@]}"; do fi done +# On NixOS, /etc/shells is a symlink to /etc/static/shells. Since symlink +# targets resolve in the sandbox's own root, not relative to /var/run/host, +# that inner hop 404s unless /etc/static/shells also exists in the sandbox. +if [ ! -e /etc/static/shells ] && [ -e /var/run/host/etc/static/shells ]; then + ln -s /var/run/host/etc/static/shells /etc/static/shells +fi + if [ ! -e /etc/shells ] && [ -e /var/run/host/etc/shells ]; then ln -s /var/run/host/etc/shells /etc/shells fi