Skip to content

Commit 8ea4aed

Browse files
committed
Auto-enter pixi shell for interactive terminals
1 parent 223fb8e commit 8ea4aed

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN apt-get update -qq && apt-get install -y --no-install-recommends \
1717
ENV PIXI_HOME="/opt/pixi" PATH="/opt/pixi/bin:${PATH}"
1818
RUN curl -fsSL https://pixi.sh/install.sh | PIXI_VERSION=${PIXI_VERSION} PIXI_HOME=${PIXI_HOME} bash
1919

20+
COPY .devcontainer/pixi-auto-shell.sh /etc/profile.d/pixi-auto-shell.sh
21+
2022
WORKDIR /workspaces/dart
2123

2224
ENTRYPOINT ["/usr/bin/tini", "--"]

.devcontainer/pixi-auto-shell.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Auto-enter the pixi environment for interactive shells.
2+
# Skips root, non-interactive sessions, and re-entry loops.
3+
4+
case "$-" in
5+
*i*) ;;
6+
*) return 0 ;;
7+
esac
8+
9+
[ "$(id -u)" -eq 0 ] && return 0
10+
[ -n "$PIXI_AUTO_SHELL" ] && return 0
11+
command -v pixi >/dev/null 2>&1 || return 0
12+
[ -f /workspaces/dart/pixi.toml ] || return 0
13+
14+
export PIXI_AUTO_SHELL=1
15+
cd /workspaces/dart
16+
exec pixi shell

0 commit comments

Comments
 (0)