Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions images/devops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ rm -rf /var/lib/apt/lists/*
# Create /nix owned by coder for single-user Nix install
mkdir -p /nix
chown coder:coder /nix

# Enable flakes and nix-command (system-wide, outside home volume)
mkdir -p /etc/nix
echo 'experimental-features = nix-command flakes' > /etc/nix/nix.conf
EOF

USER coder

# Install Nix in single-user mode (no daemon, no systemd required)
RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon

# Enable flakes and nix-command
RUN mkdir -p ~/.config/nix && \
echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf

ENV PATH="/home/coder/.nix-profile/bin:${PATH}"
# Symlink nix binaries into /usr/local/bin so they survive the home volume mount.
# We resolve through ~/.nix-profile (which exists at build time) to the real
# /nix/store/… paths that persist outside the home directory.
USER root
RUN for bin in /home/coder/.nix-profile/bin/nix*; do \
ln -s "$(readlink -f "$bin")" "/usr/local/bin/$(basename "$bin")"; \
done
USER coder
Loading