diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | alpine/Dockerfile | 13 | ||||
-rw-r--r-- | debian/Dockerfile | 13 | ||||
-rwxr-xr-x | files/.profile | 14 |
4 files changed, 37 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index 32a66bb..6da21de 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -14,6 +14,6 @@ matrix: | |||
14 | - env: BASE_OS=debian | 14 | - env: BASE_OS=debian |
15 | 15 | ||
16 | script: | 16 | script: |
17 | - docker build --pull -t fretlink/nix ${BASE_OS}/ | 17 | - docker build --pull -t fretlink/nix -f ${BASE_OS}/Dockerfile . |
18 | - docker run -it --rm fretlink/nix 'nix-channel --list' | 18 | - docker run -it --rm fretlink/nix 'nix-channel --list' |
19 | - docker run -it --rm fretlink/nix 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"' | 19 | - docker run -it --rm fretlink/nix 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"' |
diff --git a/alpine/Dockerfile b/alpine/Dockerfile index 1b3d229..0e42345 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile | |||
@@ -36,8 +36,17 @@ RUN nix-channel --add https://nixos.org/channels/nixpkgs-19.09-darwin nixpkgs \ | |||
36 | # Propagate UTF8 | 36 | # Propagate UTF8 |
37 | # https://github.com/NixOS/nix/issues/599#issuecomment-153885553 | 37 | # https://github.com/NixOS/nix/issues/599#issuecomment-153885553 |
38 | # The same is hapenning with stack2nix | 38 | # The same is hapenning with stack2nix |
39 | RUN nix-env -iA nixpkgs.glibcLocales \ | 39 | RUN nix-env -iA nixpkgs.glibcLocales |
40 | && echo "export LOCALE_ARCHIVE=$(nix-env --installed --no-name --out-path --query glibc-locales)/lib/locale/locale-archive" >> ${HOME}/.profile | 40 | |
41 | # < Nix context as a volume | ||
42 | # We want to be able to define /nix/store as a volume | ||
43 | # We thus need to "save" the current nix context to be able | ||
44 | # to restore it at startup time | ||
45 | RUN cp -R /nix /home/nixuser/initial-nix | ||
46 | VOLUME ["/nix"] | ||
47 | # Create bash profile | ||
48 | COPY --chown=nixuser:nixuser files/.profile ${HOME}/.profile | ||
49 | # /> | ||
41 | 50 | ||
42 | # Make sure to use "login" shell when running container | 51 | # Make sure to use "login" shell when running container |
43 | ENTRYPOINT ["/usr/bin/env", "bash", "-l", "-c"] | 52 | ENTRYPOINT ["/usr/bin/env", "bash", "-l", "-c"] |
diff --git a/debian/Dockerfile b/debian/Dockerfile index 5c4c46f..90b2e65 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile | |||
@@ -36,8 +36,17 @@ RUN nix-channel --add https://nixos.org/channels/nixpkgs-19.09-darwin nixpkgs \ | |||
36 | # Propagate UTF8 | 36 | # Propagate UTF8 |
37 | # https://github.com/NixOS/nix/issues/599#issuecomment-153885553 | 37 | # https://github.com/NixOS/nix/issues/599#issuecomment-153885553 |
38 | # The same is hapenning with stack2nix | 38 | # The same is hapenning with stack2nix |
39 | RUN nix-env -iA nixpkgs.glibcLocales \ | 39 | RUN nix-env -iA nixpkgs.glibcLocales |
40 | && echo "export LOCALE_ARCHIVE=$(nix-env --installed --no-name --out-path --query glibc-locales)/lib/locale/locale-archive" >> ${HOME}/.profile | 40 | |
41 | # < Nix context as a volume | ||
42 | # We want to be able to define /nix/store as a volume | ||
43 | # We thus need to "save" the current nix context to be able | ||
44 | # to restore it at startup time | ||
45 | RUN cp -R /nix /home/nixuser/initial-nix | ||
46 | VOLUME ["/nix"] | ||
47 | # Create bash profile | ||
48 | COPY --chown=nixuser:nixuser files/.profile ${HOME}/.profile | ||
49 | # /> | ||
41 | 50 | ||
42 | # Make sure to use "login" shell when running container | 51 | # Make sure to use "login" shell when running container |
43 | ENTRYPOINT ["/usr/bin/env", "bash", "-l", "-c"] | 52 | ENTRYPOINT ["/usr/bin/env", "bash", "-l", "-c"] |
diff --git a/files/.profile b/files/.profile new file mode 100755 index 0000000..68b4473 --- /dev/null +++ b/files/.profile | |||
@@ -0,0 +1,14 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # Copy initial saved nix context if the /nix is empty | ||
4 | [ ! "$(ls -A /nix)" ] && cp -R ~/initial-nix/* /nix/ | ||
5 | |||
6 | # Source nix environment | ||
7 | nix_profile="/home/nixuser/.nix-profile/etc/profile.d/nix.sh" | ||
8 | # shellcheck source=/home/nixuser/.nix-profile/etc/profile.d/nix.sh | ||
9 | [ -e "${nix_profile}" ] && . "${nix_profile}" | ||
10 | |||
11 | # Propagate UTF8 | ||
12 | # https://github.com/NixOS/nix/issues/599#issuecomment-153885553 | ||
13 | LOCALE_ARCHIVE="$(nix-env --installed --no-name --out-path --query glibc-locales)/lib/locale/locale-archive" | ||
14 | export LOCALE_ARCHIVE | ||