Skip to content

Instantly share code, notes, and snippets.

@Br1ght0ne
Last active November 27, 2019 11:14
Show Gist options
  • Save Br1ght0ne/e89dee5a4749f9a0891cb1ebd520a7ec to your computer and use it in GitHub Desktop.
Save Br1ght0ne/e89dee5a4749f9a0891cb1ebd520a7ec to your computer and use it in GitHub Desktop.
Nix package manager on Alpine Edge
FROM alpine:edge
# Dependencies
RUN apk add curl
# Nix user and store setup
RUN adduser -D nix
RUN mkdir /nix
RUN chown nix /nix
# Switch to nix user
USER nix
ENV USER=nix
WORKDIR /home/nix
# Install Nix in single user mode
RUN curl https://nixos.org/nix/install > /tmp/nix-install.sh
RUN sh /tmp/nix-install.sh --no-daemon
# Add nix-* commands to PATH
RUN echo 'source /home/nix/.nix-profile/etc/profile.d/nix.sh' > .profile
# Update channels
RUN sh -l -c 'nix-channel --update'
# sh -l is needed to pick up .profile
CMD ["/bin/sh", "-l"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment