forked from BloopAI/bloop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitpod.Dockerfile
42 lines (32 loc) · 1.65 KB
/
.gitpod.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
41
42
FROM axonasif/workspace-base
ARG NIX_VERSION="2.11.0"
ARG NIX_CONFIG="experimental-features = nix-command flakes"
ENV NIX_VERSION=${NIX_VERSION}
USER root
# Dazzle does not rebuild a layer until one of its lines are changed. Increase this counter to rebuild this layer.
ENV TRIGGER_REBUILD=1
RUN addgroup --system nixbld \
&& adduser gitpod nixbld \
&& for i in $(seq 1 30); do useradd -ms /bin/bash nixbld$i && adduser nixbld$i nixbld; done \
&& mkdir -m 0755 /nix && chown gitpod /nix \
&& mkdir -p /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf
# Install Nix
USER gitpod
ENV USER gitpod
WORKDIR /home/gitpod
RUN curl https://nixos.org/releases/nix/nix-$NIX_VERSION/install | sh
RUN echo '. /home/gitpod/.nix-profile/etc/profile.d/nix.sh' >> /home/gitpod/.bashrc.d/200-nix
RUN mkdir -p /home/gitpod/.config/nixpkgs && echo '{ allowUnfree = true; }' >> /home/gitpod/.config/nixpkgs/config.nix
RUN mkdir -p /home/gitpod/.config/nix && echo $NIX_CONFIG >> /home/gitpod/.config/nix/nix.conf
# Install cachix
RUN . /home/gitpod/.nix-profile/etc/profile.d/nix.sh \
&& nix-env -iA cachix -f https://cachix.org/api/v1/install \
&& cachix use cachix
# Install direnv & other files
RUN mkdir -p $HOME/.config/direnv && printf '%s\n' "[whitelist]" 'prefix = [ "/workspace" ]' > $HOME/.config/direnv/config.toml \
&& printf '%s\n' 'source <(direnv hook bash)' > $HOME/.bashrc.d/999-direnv \
&& printf '%s\n' \
'dirs=($HOME/.cargo $HOME/.cache/nix) && mkdir -p "${dirs[@]}"' \
'create-overlay /nix "${dirs[@]}"' > $HOME/.runonce/100-nix \
&& . /home/gitpod/.nix-profile/etc/profile.d/nix.sh \
&& nix-env -iA nixpkgs.direnv