X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=alpine%2FDockerfile;h=db794af285bbbf9fc247343fffc5f58e51145fbb;hb=51ca88242693d27bff139f25e363c0c629dd05b5;hp=0e4234539357a5e9e06df70ee2f21bdc4d712f91;hpb=937d660cdc7b7b82cc6e75641ee6f21ff43e017a;p=github%2Ffretlink%2Fdocker-nix.git diff --git a/alpine/Dockerfile b/alpine/Dockerfile index 0e42345..db794af 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -2,7 +2,7 @@ FROM alpine ARG NIX_VERSION -ENV NIX_VERSION ${NIX_VERSION:-2.3.1} +ENV NIX_VERSION ${NIX_VERSION:-2.3.9} ARG LANG ENV LANG ${LANG:-"en_US.UTF-8"} @@ -18,34 +18,31 @@ RUN addgroup -g 30000 -S nixbld \ USER nixuser ENV USER=nixuser ENV HOME="/home/nixuser" +ENV NIX_SYSTEM_PATH="/nix/var/nix/profiles/system" +ENV NIX_PROFILE="$HOME/nix-envs" RUN cd && wget https://nixos.org/releases/nix/nix-$NIX_VERSION/nix-$NIX_VERSION-x86_64-linux.tar.xz \ && tar xJf nix-*-x86_64-linux.tar.xz \ - && ~/nix-*-x86_64-linux/install \ + && NIX_PROFILE="$NIX_SYSTEM_PATH" ~/nix-*-x86_64-linux/install \ && rm -rf ~/nix-*-* -ENV ENV="/home/nixuser/.nix-profile/etc/profile.d/nix.sh" -RUN echo ". ${ENV}" >> ${HOME}/.profile # All subsequent "RUN" will use a login shell SHELL ["/usr/bin/env", "bash", "-l", "-c"] -RUN nix-channel --add https://nixos.org/channels/nixpkgs-19.09-darwin nixpkgs \ - && nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable \ +# Create bash profile +COPY --chown=nixuser:nixuser files/.profile ${HOME}/.profile + +RUN nix-channel --add https://nixos.org/channels/nixos-unstable nixpkgs \ && nix-channel --update # Propagate UTF8 # https://github.com/NixOS/nix/issues/599#issuecomment-153885553 # The same is hapenning with stack2nix -RUN nix-env -iA nixpkgs.glibcLocales +RUN nix-env -p "$NIX_SYSTEM_PATH" -iA nixpkgs.glibcLocales # < Nix context as a volume # We want to be able to define /nix/store as a volume -# We thus need to "save" the current nix context to be able -# to restore it at startup time -RUN cp -R /nix /home/nixuser/initial-nix VOLUME ["/nix"] -# Create bash profile -COPY --chown=nixuser:nixuser files/.profile ${HOME}/.profile # /> # Make sure to use "login" shell when running container