Initial commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon Bruder 2020-10-10 13:01:07 +02:00
commit b8c4e671c2
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
3 changed files with 41 additions and 0 deletions

14
.drone.yml Normal file
View file

@ -0,0 +1,14 @@
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
settings:
registry: r.sbruder.de
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.sbruder.de/drone-nix-runner
squash: true # since we move the nix store and dont want to store it twice

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM nixos/nix
RUN mv /nix/store/ /nix/store-upstream/
# installed from alpine to not pollute nix store
RUN apk add --no-cache \
git \
git-lfs \
rsync \
su-exec
ARG DRONE_RUNNER_EXEC_VERSION=1.0.0-beta.9
RUN wget -O- https://github.com/drone-runners/drone-runner-exec/releases/download/v${DRONE_RUNNER_EXEC_VERSION}/drone_runner_exec_linux_amd64.tar.gz | tar -C /usr/local/bin -xzvf-
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
ENV DRONE_RUNNER_ENVIRON=NIX_PATH:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs
EXPOSE 3000

8
entrypoint.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
echo "Restoring upstream nix store…"
mkdir -p /nix/store
chmod 1775 /nix/store
chgrp nixbld /nix/store
rsync -a /nix/store-upstream/./ /nix/store
nix-daemon &
exec su-exec nobody:nogroup /usr/local/bin/drone-runner-exec