# Start with a official gitea runner image based on ubuntu with node installed
FROM docker.gitea.com/runner-images:ubuntu-latest-slim

# Install system dependencies
RUN apt-get update && \
    apt-get install -y sudo bash jq xz-utils curl && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install Nix as a multi-user installation
RUN curl -L https://nixos.org/nix/install | sh -s -- --daemon
ENV PATH="/nix/var/nix/profiles/default/bin:$PATH"

# Enable flakes and nix-command
RUN mkdir -p /etc/nix && \
    echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf

# Install devenv (the Nix way, not the apt-get way)
RUN nix profile add nixpkgs#devenv && \
    nix-collect-garbage -d 

CMD ["/bin/bash"]
