Skip to content

Commit c50ebeb

Browse files
committed
fix(runner): error on host /nix symlinks in NixOS container
NixOS containers have their own /nix store, so .bin/ symlinks pointing to host /nix paths will not exist inside the container. Detect this case and report it as an error instead of silently skipping. Also update the generic error footer to not imply that all /nix symlinks are valid inside any container.
1 parent c962da2 commit c50ebeb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

runner/runc.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,13 @@ if [ -d "$BIN_DIR" ] && ls -A "$BIN_DIR" 2>/dev/null | grep -q .; then
117117
# fully-resolved path is under /nix.
118118
if [ -L "$f" ]; then
119119
direct=$(readlink "$f")
120-
[[ "$direct" == /nix/* ]] && continue
120+
if [[ "$direct" == /nix/* ]]; then
121+
if [ "$CONTAINER_TYPE" = "nixos" ]; then
122+
# NixOS container has its own /nix store; host /nix paths will not exist inside it.
123+
bad+=("$(basename "$f") -> $direct (symlink to host /nix path; will not work in NixOS container with separate /nix store)")
124+
fi
125+
continue
126+
fi
121127
bad+=("$(basename "$f") -> $direct (symlink does not point directly into /nix)")
122128
continue
123129
fi
@@ -138,7 +144,7 @@ if [ -d "$BIN_DIR" ] && ls -A "$BIN_DIR" 2>/dev/null | grep -q .; then
138144
if [ ${#bad[@]} -gt 0 ]; then
139145
echo "Error: the following .bin/ entries will not work inside the container:" >&2
140146
for b in "${bad[@]}"; do echo " $b" >&2; done
141-
echo "Only Nix-store symlinks (/nix/...) and statically-linked binaries are supported." >&2
147+
echo "Only symlinks into the container's own /nix store and statically-linked binaries are supported." >&2
142148
exit 1
143149
fi
144150
fi

0 commit comments

Comments
 (0)