35 lines
1.2 KiB
Docker
35 lines
1.2 KiB
Docker
# Use the nixpkgs/nix image
|
|
# https://github.com/NixOS/nix/tags
|
|
FROM nixos/nix:2.24.7
|
|
|
|
# Set the working directory
|
|
WORKDIR /root/working-dir
|
|
|
|
ARG MAIN_NIX_CHANNEL=https://nixos.org/channels/nixos-24.05
|
|
ARG MAIN_NIX_CHANNEL_NAME=nixpkgs
|
|
|
|
ENV NIXPKGS_ALLOW_UNFREE=1
|
|
|
|
# Set environment variables
|
|
ENV NIX_PATH=nixpkgs=channel:nixos-24.05
|
|
|
|
ARG NIX_CONFIG=
|
|
ADD nix.conf /etc/nix/nix.conf
|
|
RUN echo $'\n'"${NIX_CONFIG}" >> /etc/nix/nix.conf
|
|
|
|
RUN mkdir -p "/root" && touch "/root/.nix-channels" && \
|
|
if [[ ! -f "/root/.nix-profile" ]]; then ln -sf /nix/var/nix/profiles/default "/root/.nix-profile"; fi && \
|
|
. /nix/var/nix/profiles/default/etc/profile.d/nix.sh && \
|
|
nix-channel --add ${MAIN_NIX_CHANNEL} ${MAIN_NIX_CHANNEL_NAME} && \
|
|
nix-channel --update
|
|
|
|
RUN chown $USER_UID:$USER_GID /nix \
|
|
&& chown $USER_UID:$USER_GID /nix/store \
|
|
&& chown -R $USER_UID:$USER_GID /nix/var
|
|
|
|
RUN bash -c "nix-env -iA nixpkgs.go nixpkgs.vim nixpkgs.sops nixpkgs.nix-direnv nixpkgs.attic-client nixpkgs.nh nixpkgs.deploy-rs nixpkgs.statix nixpkgs.deadnix nixpkgs.alejandra nixpkgs.git nixpkgs.ssh-to-age nixpkgs.gnupg nixpkgs.age nixpkgs.linux nixpkgs.go-task nixpkgs.curl nixpkgs.fish nixpkgs.docker"
|
|
|
|
ENTRYPOINT ["fish"]
|
|
|
|
# Start bash shell
|
|
CMD [ "-c", "nix develop" ]
|