Skip to content

Commit 53aa7e3

Browse files
authored
Merge pull request #3409 from IntersectMBO/fix_separate_nix_store
fix(runner): error on host /nix symlinks in NixOS container
2 parents c962da2 + c50ebeb commit 53aa7e3

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)