Skip to content

Commit 2cd30e7

Browse files
blooopclaude
andcommitted
Fix pixi trampoline bug and defer claude download to first run
- Add conditional PATH entry for ~/.pixi/envs/claude-shim/bin to work around pixi trampoline bug that fails for bash script executables - Remove claude --version calls during feature install to avoid downloading the Claude binary during container build - Claude binary will now be downloaded on first user invocation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6330d33 commit 2cd30e7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ USER vscode
1111
WORKDIR /home/vscode
1212

1313
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc \
14-
&& echo 'export PATH="$HOME/.pixi/bin:$PATH"' >> /home/vscode/.profile
14+
&& echo 'export PATH="$HOME/.pixi/bin:$PATH"' >> /home/vscode/.profile \
15+
&& echo '# Workaround: pixi trampoline fails for bash scripts, so add env bin directly' >> /home/vscode/.profile \
16+
&& echo '[ -d "$HOME/.pixi/envs/claude-shim/bin" ] && export PATH="$HOME/.pixi/envs/claude-shim/bin:$PATH"' >> /home/vscode/.profile
1517

1618
# Create .ssh directory with proper permissions for SSH config mounts
1719
RUN mkdir -p /home/vscode/.ssh && chmod 700 /home/vscode/.ssh

.devcontainer/claude-code/install.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ install_claude_code() {
8282
fi
8383

8484
# Add pixi bin path to user's profile if not already there
85-
# Only add ~/.pixi/bin - avoid hardcoding env-specific paths that may change
8685
local profile="$TARGET_HOME/.profile"
8786
local pixi_path_line='export PATH="$HOME/.pixi/bin:$PATH"'
8887
if [ -f "$profile" ] && ! grep -q '\.pixi/bin' "$profile"; then
@@ -92,12 +91,20 @@ install_claude_code() {
9291
chown "$TARGET_USER:$TARGET_USER" "$profile" 2>/dev/null || true
9392
fi
9493

95-
# Verify installation by checking the binary exists
94+
# Workaround: pixi trampoline fails for bash scripts, so add env bin directly
95+
# This conditionally adds the path only if the env exists
96+
local env_path_line='[ -d "$HOME/.pixi/envs/claude-shim/bin" ] && export PATH="$HOME/.pixi/envs/claude-shim/bin:$PATH"'
97+
if [ -f "$profile" ] && ! grep -q 'pixi/envs/claude-shim' "$profile"; then
98+
echo "# Workaround: pixi trampoline fails for bash scripts" >> "$profile"
99+
echo "$env_path_line" >> "$profile"
100+
fi
101+
102+
# Verify installation by checking the trampoline exists (don't run it - that triggers download)
96103
local pixi_bin_path="$TARGET_HOME/.pixi/bin"
97104
local claude_bin="$pixi_bin_path/claude"
98105
if [ -x "$claude_bin" ]; then
99106
echo "Claude Code CLI installed successfully!"
100-
"$claude_bin" --version
107+
echo "(Claude binary will be downloaded on first run)"
101108
return 0
102109
else
103110
echo "ERROR: Claude Code CLI installation failed! Binary not found at $claude_bin"
@@ -154,7 +161,6 @@ main() {
154161
# Install Claude Code CLI
155162
if [ -x "$claude_bin" ]; then
156163
echo "Claude Code CLI is already installed"
157-
"$claude_bin" --version
158164
else
159165
install_claude_code || exit 1
160166
fi

0 commit comments

Comments
 (0)