-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (34 loc) · 1.51 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
41
42
43
FROM ubuntu:24.04
# Install some base system dependencies
RUN apt-get update && \
apt-get install curl git python3 xz-utils sudo --yes && \
rm -rf /var/lib/apt/lists/*
# Create the gizmo user
RUN useradd -ms /bin/bash gizmo
RUN echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Setup the nix mount and make gizmo the owner
RUN mkdir -m 0755 /nix && chown gizmo /nix
RUN mkdir /home/gizmo/.vim && chown gizmo /home/gizmo/.vim
# Switch to gizmo
USER gizmo
ENV USER=gizmo
ENV BUILDING_DOTFILES_CONTAINER=1
# Install nix and home-manager
RUN curl -L https://nixos.org/nix/install | sh
RUN . $HOME/.nix-profile/etc/profile.d/nix.sh
RUN $HOME/.nix-profile/bin/nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
RUN $HOME/.nix-profile/bin/nix-channel --update
RUN . $HOME/.nix-profile/etc/profile.d/nix.sh && nix-shell '<home-manager>' -A install
# Make some directories
RUN mkdir -p $HOME/.config/home-manager
RUN mkdir -p $HOME/.config/nix
# Copy the dotfiles and install them
WORKDIR /home/gizmo/workspaces/dotfiles
COPY --chown=gizmo . .
RUN ln -sf /home/gizmo/workspaces/dotfiles/modules/home.nix $HOME/.config/home-manager/home.nix
RUN ln -sf /home/gizmo/workspaces/dotfiles/configs/nix.conf $HOME/.config/nix/nix.conf
# Install the flake
RUN . $HOME/.nix-profile/etc/profile.d/nix.sh && home-manager switch --impure --flake .#docker
# Swap back to the home directory, swap the default shell, and setup the entrypoint command
WORKDIR /home/gizmo
CMD ["/home/gizmo/.nix-profile/bin/zsh"]