diff --git a/dev/guix/Dockerfile b/dev/guix/Dockerfile new file mode 100644 index 0000000..2deb5c3 --- /dev/null +++ b/dev/guix/Dockerfile @@ -0,0 +1,32 @@ +FROM alpine + +# Add Tini +ENV TINI_VERSION v0.8.3 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini +RUN chmod +x /tini +ADD ./entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] + +ENV GUIX_VERSION 0.9.0 +ENV PATH $PATH:/var/guix/profiles/default/guix-profile/bin + +# update to edge +ADD repositories /etc/apk/repositories +RUN apk update && apk upgrade + +# install guix in one pass +RUN set -x && apk update && apk add xz tar wget runit \ + && wget ftp://alpha.gnu.org/gnu/guix/guix-binary-0.9.0.x86_64-linux.tar.xz -O guix.tar.xz \ + && tar xJf guix.tar.xz \ + && rm guix.tar.xz \ + && addgroup guixbuild \ + && chmod 1775 /gnu/store \ + && ln -sf /var/guix/profiles/per-user/root/guix-profile ~root/.guix-profile \ + && mkdir -p /usr/local/bin \ + && cd /usr/local/bin \ + && ln -s /var/guix/profiles/per-user/root/guix-profile/bin/guix \ + && guix archive --authorize < ~root/.guix-profile/share/guix/hydra.gnu.org.pub \ + && adduser -S guix-builder guix-builder \ + && adduser guix-builder guixbuild + +ADD runit/ /etc/system diff --git a/dev/guix/README.md b/dev/guix/README.md new file mode 100644 index 0000000..a7eca03 --- /dev/null +++ b/dev/guix/README.md @@ -0,0 +1,14 @@ +# Guix in Docker + +Guix is cool, so is Docker, why not combine them? + +```console +$ docker build -t xena/guix . +$ docker run --rm -it --privileged xena/guix /bin/sh +$ pstree +tini-+-runsvdir---runsv---run---guix-daemon +`-sh---pstree +$ guix package --install hello +$ hello +Hello, world! +``` diff --git a/dev/guix/entrypoint.sh b/dev/guix/entrypoint.sh new file mode 100755 index 0000000..9147088 --- /dev/null +++ b/dev/guix/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +runsvdir /etc/system & + +exec /tini -- $* diff --git a/dev/guix/repositories b/dev/guix/repositories new file mode 100644 index 0000000..9293072 --- /dev/null +++ b/dev/guix/repositories @@ -0,0 +1,2 @@ +http://dl-4.alpinelinux.org/alpine/edge/main +http://dl-4.alpinelinux.org/alpine/edge/testing diff --git a/dev/guix/runit/guix-daemon/run b/dev/guix/runit/guix-daemon/run new file mode 100755 index 0000000..da8cc2b --- /dev/null +++ b/dev/guix/runit/guix-daemon/run @@ -0,0 +1,3 @@ +#!/bin/sh + +~root/.guix-profile/bin/guix-daemon --build-users-group=guixbuild