FROM astral/uv:python3.12-trixie-slim

RUN apt update && \
    apt install -y btop curl git tree wget zsh && \
    apt clean && rm -rf /var/lib/apt/lists/*

RUN sh -c "$(wget -O- https://install.ohmyz.sh)" && \
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && \
    sed -i 's/plugins=(git)/plugins=(z git zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrc
RUN git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure" && \
    echo '' >> ~/.zshrc && \
    echo '# Pure prompt' >> ~/.zshrc && \
    echo 'fpath+=("$HOME/.zsh/pure")' >> ~/.zshrc && \
    echo 'autoload -U promptinit; promptinit' >> ~/.zshrc && \
    echo 'prompt pure' >> ~/.zshrc

ARG JUJUTSU_VERSION=0.44.0
ARG TARGETARCH
RUN ARCH=$([ "$TARGETARCH" = "amd64" ] && echo "x86_64" || echo "aarch64") && \
    wget -qO- https://github.com/jj-vcs/jj/releases/download/v${JUJUTSU_VERSION}/jj-v${JUJUTSU_VERSION}-${ARCH}-unknown-linux-musl.tar.gz | \
    tar -xzO ./jj > /usr/local/bin/jj && \
    chmod +x /usr/local/bin/jj && \
    echo 'source <(COMPLETE=zsh jj)' >> ~/.zshrc
