FROM archlinux:latest

RUN pacman -Sy --noconfirm archlinux-keyring && \
    pacman -Su --noconfirm && \
    pacman -S --noconfirm --needed \
        bash \
        ca-certificates \
        curl \
        fastfetch \
        fzf \
        git \
        lazygit \
        less \
        mariadb-clients \
        nodejs \
        npm \
        openssh \
        php \
        pwgen \
        python \
        sqlite \
        tmux \
        tree \
        unzip \
        uv \
        vim \
        zoxide && \
    pacman -Scc --noconfirm

RUN printf '%s\n' \
        'export PATH="/root/.local/bin:$PATH"' \
        'eval "$(zoxide init bash)"' \
        > /etc/profile.d/nix_path.sh && \
    chmod 755 /etc/profile.d/nix_path.sh && \
    echo '[ -f /etc/profile.d/nix_path.sh ] && . /etc/profile.d/nix_path.sh' >> /etc/bash.bashrc

RUN git config --system user.name "code" && \
    git config --system user.email "code@4lt.ca" && \
    git config --system --add safe.directory '*'

# Dotfiles
COPY files/bash_aliases /opt/dotfiles/bash_aliases
COPY files/bashrc /root/.bashrc

# Install Claude Code straight into /root, so a rebuild always picks up the
# latest release. Only the two files needed to stay logged in (not the CLI
# itself) are persisted across rebuilds, via individual bind mounts set up
# by `claudaris start` — see claudaris and AGENTS.md.
WORKDIR /tmp

RUN curl -fsSL https://claude.ai/install.sh | bash

# Claude Code usage statusline plugin
RUN PATH="/root/.local/bin:$PATH" bash -c \
    'curl -fsSL https://raw.githubusercontent.com/leeguooooo/claude-code-usage-bar/main/web-install.sh | bash'

# tmux wrapper
COPY files/tmux /usr/local/bin/tmux
COPY files/tmux.conf /etc/tmux.conf
RUN chmod 755 /usr/local/bin/tmux

# Container entrypoint
COPY files/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod 755 /usr/local/bin/entrypoint.sh

WORKDIR /projects

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]