diff options
author | Paul B <paul@bonaud.fr> | 2018-10-26 11:14:29 +0200 |
---|---|---|
committer | Paul B <paul@bonaud.fr> | 2018-10-26 11:14:29 +0200 |
commit | 89f0519e224b69c975d16cc27f0ded89a515dfb3 (patch) | |
tree | 8547c2a58d273af1f4d061d1b889d2a04978563b /Dockerfile | |
download | docker-nix-89f0519e224b69c975d16cc27f0ded89a515dfb3.tar.gz docker-nix-89f0519e224b69c975d16cc27f0ded89a515dfb3.tar.zst docker-nix-89f0519e224b69c975d16cc27f0ded89a515dfb3.zip |
Initial nix docker image
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5841614 --- /dev/null +++ b/Dockerfile | |||
@@ -0,0 +1,25 @@ | |||
1 | # Dockerfile to create an environment that contains the Nix package manager. | ||
2 | FROM alpine | ||
3 | |||
4 | ARG NIX_VERSION | ||
5 | ENV NIX_VERSION ${NIX_VERSION:-2.1.3} | ||
6 | |||
7 | RUN addgroup -g 30000 -S nixbld \ | ||
8 | && for i in $(seq 1 30); do adduser -S -D -h /var/empty -g "Nix build user $i" -u $((30000 + i)) -G nixbld nixbld$i ; done \ | ||
9 | && adduser -D nixuser \ | ||
10 | && mkdir -m 0755 /nix && chown nixuser /nix \ | ||
11 | && apk add --no-cache bash \ | ||
12 | && rm -rf /var/cache/apk/* | ||
13 | |||
14 | USER nixuser | ||
15 | ENV USER=nixuser | ||
16 | ENV HOME="/home/nixuser" | ||
17 | |||
18 | RUN cd && wget https://nixos.org/releases/nix/nix-$NIX_VERSION/nix-$NIX_VERSION-x86_64-linux.tar.bz2 \ | ||
19 | && tar xjf nix-*-x86_64-linux.tar.bz2 \ | ||
20 | && ~/nix-*-x86_64-linux/install \ | ||
21 | && rm -rf ~/nix-*-* | ||
22 | |||
23 | ENV ENV="/home/nixuser/.nix-profile/etc/profile.d/nix.sh" | ||
24 | RUN ln -s ${ENV} ${HOME}/.profile | ||
25 | SHELL ["/usr/bin/env", "bash", "-l", "-c"] | ||