-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (27 loc) · 1.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
git \
gnupg2 \
ca-certificates \
lsb-release \
sudo \
xz-utils \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN useradd -ms /bin/bash nixuser
RUN echo 'nixuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN sudo -u nixuser \
sh -c 'curl -L https://nixos.org/nix/install | bash'
RUN mkdir -p /etc/nix
RUN echo 'experimental-features = nix-command flakes' | tee -a /etc/nix/nix.conf
ENV USER=nixuser
ENV HOME=/home/nixuser
ENV PATH=/home/nixuser/.nix-profile/bin:/home/nixuser/.nix-profile/sbin:/home/nixuser/.nix-defexpr/channels_root:/nix/var/nix/profiles/per-user/root/channels/root:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
ENV NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos
RUN mkdir -p /nix && chown nixuser /nix
USER nixuser
WORKDIR /home/nixuser
RUN /bin/bash -c 'source $HOME/.nix-profile/etc/profile.d/nix.sh && nix --version && nix-collect-garbage -d'
CMD ["/bin/bash"]