FROM ghcr.io/cameronraysmith/debnix:latest

USER root
COPY . ${HOME}/work/
RUN chown -R ${USER} ${HOME}/work/
RUN cat <<EOF >> /etc/nix/nix.conf
extra-trusted-public-keys = sciexp.cachix.org-1:HaliIGqJrFN7CDrzYVHqWS4uSISorWAY1bWNmNl8T08=
extra-substituters = https://sciexp.cachix.org
accept-flake-config = true
EOF

USER ${USER}
WORKDIR ${HOME}/work
RUN for file in ${HOME}/.bashrc ${HOME}/.profile; do \
        mv "$file" "$file.before-nix-run"; \
    done
RUN nix run --accept-flake-config --print-build-logs --show-trace

ENTRYPOINT [ "zsh" ]
