Created
June 9, 2021 18:04
-
-
Save SomeoneSerge/8e6d5821cfc3331c3ea734ee923884d8 to your computer and use it in GitHub Desktop.
Nix with Flakes support on top of ubuntu:20.04 docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update \ | |
&& apt-get --yes install curl xz-utils sudo \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/ \ | |
&& useradd -m -G sudo --password "!" --shell /bin/bash my-user \ | |
&& (echo 'my-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers) | |
USER my-user | |
ENV USER=my-user | |
WORKDIR /home/my-user | |
ENTRYPOINT /bin/bash | |
RUN (curl -L "https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20210429_d15a196/install" | \ | |
sh -s -- --no-daemon) \ | |
&& sudo apt-get --yes purge curl xz-utils \ | |
&& sudo mkdir /etc/nix \ | |
&& echo 'experimental-features = nix-command flakes ca-derivations ca-references' | sudo tee -a /etc/nix/nix.conf \ | |
&& echo 'PATH=$HOME/.nix-profile/bin:$PATH' | sudo tee -a /etc/bash.bashrc \ | |
&& echo 'source $HOME/.nix-profile/etc/profile.d/nix.sh' | sudo tee -a /etc/bash.bashrc \ | |
&& export "PATH=$HOME/.nix-profile/bin:$PATH" \ | |
&& nix store optimise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment