Skip to content

Commit 7a524a4

Browse files
authored
Merge pull request #3 from paulrbr-fl/add-debian-based
Add debian based images
2 parents dedbcf1 + 0366f36 commit 7a524a4

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

.travis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ addons:
88
packages:
99
- docker-ce
1010

11+
matrix:
12+
include:
13+
- env: BASE_OS=alpine
14+
- env: BASE_OS=debian
15+
1116
script:
12-
- docker build --pull -t fretlink/nix .
17+
- docker build --pull -t fretlink/nix ${BASE_OS}/
1318
- docker run -it --rm fretlink/nix 'nix-channel --list'
1419
- docker run -it --rm fretlink/nix 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"'
File renamed without changes.

debian/Dockerfile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Dockerfile to create an environment that contains the Nix package manager.
2+
FROM debian:stable-slim
3+
4+
ARG NIX_VERSION
5+
ENV NIX_VERSION ${NIX_VERSION:-2.1.3}
6+
ARG LANG
7+
ENV LANG ${LANG:-"en_US.UTF-8"}
8+
9+
RUN addgroup --gid 30000 --system nixbld \
10+
&& for i in $(seq 1 30); do adduser --system --disabled-password --home /var/empty --gecos "Nix build user $i" --uid $((30000 + i)) --ingroup nixbld nixbld$i ; done \
11+
&& adduser --disabled-password nixuser \
12+
&& mkdir -m 0755 /nix && chown nixuser /nix \
13+
&& apt update && apt install -y wget bzip2 \
14+
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
15+
16+
USER nixuser
17+
ENV USER=nixuser
18+
ENV HOME="/home/nixuser"
19+
20+
RUN cd && wget https://nixos.org/releases/nix/nix-$NIX_VERSION/nix-$NIX_VERSION-x86_64-linux.tar.bz2 \
21+
&& tar xjf nix-*-x86_64-linux.tar.bz2 \
22+
&& ~/nix-*-x86_64-linux/install \
23+
&& rm -rf ~/nix-*-*
24+
25+
ENV ENV="/home/nixuser/.nix-profile/etc/profile.d/nix.sh"
26+
RUN echo ". ${ENV}" >> ${HOME}/.profile
27+
# All subsequent "RUN" will use a login shell
28+
SHELL ["/usr/bin/env", "bash", "-l", "-c"]
29+
30+
RUN nix-channel --add https://nixos.org/channels/nixpkgs-unstable \
31+
&& nix-channel --update
32+
33+
# Propagate UTF8
34+
# https://github.com/NixOS/nix/issues/599#issuecomment-153885553
35+
# The same is hapenning with stack2nix
36+
RUN nix-env -iA nixpkgs.glibcLocales \
37+
&& echo "export LOCALE_ARCHIVE=$(nix-env --installed --no-name --out-path --query glibc-locales)/lib/locale/locale-archive" >> ${HOME}/.profile
38+
39+
# Make sure to use "login" shell when running container
40+
ENTRYPOINT ["/usr/bin/env", "bash", "-l", "-c"]

0 commit comments

Comments
 (0)