Skip to content

Instantly share code, notes, and snippets.

@3noch
Last active November 27, 2020 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3noch/7b5e7c01e33a128d2635f16862d21866 to your computer and use it in GitHub Desktop.
Save 3noch/7b5e7c01e33a128d2635f16862d21866 to your computer and use it in GitHub Desktop.
Ubuntu with Nix Installed (Dockerfile)
FROM ubuntu:20.10
RUN apt-get update && \
apt-get install -y sudo curl xz-utils && apt-get clean && \
useradd builder -d /home/builder && \
mkdir /home/builder && chown builder /home/builder && \
echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \
chmod 0440 /etc/sudoers.d/user && \
(su builder --login -c 'curl -L https://nixos.org/nix/install | sh') && \
apt-get remove -y curl xz-utils && apt-get autoremove -y && apt-get clean && \
echo '. /home/builder/.nix-profile/etc/profile.d/nix.sh' >> /home/builder/.bashrc
USER builder
ENV USER builder
ENV PATH "/home/builder/.nix-profile/bin:$PATH"
ENV NIX_PROFILES /nix/var/nix/profiles/default /home/builder/.nix-profile
ENV NIX_PATH /home/builder/.nix-defexpr/channels
ENV NIX_SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment