diff --git a/nix/Dockerfile b/nix/Dockerfile new file mode 100644 index 0000000..f1af5c3 --- /dev/null +++ b/nix/Dockerfile @@ -0,0 +1,20 @@ +ARG NIX_VERSION +FROM nixos/nix:${NIX_VERSION} + +ARG JENKINS_UID +ARG JENKINS_GID + +RUN addgroup -g ${JENKINS_GID} jenkins \ + && adduser -D -u ${JENKINS_UID} -G jenkins jenkins \ + -s /nix/var/nix/profiles/default/bin/nix-shell \ + && chown jenkins:jenkins -R /nix + +ADD nix.conf /home/jenkins/.config/nix/nix.conf +ADD default.nix home/jenkins/default.nix + +WORKDIR /home/jenkins + +USER jenkins + +MAINTAINER Jakub Sokolowski "jakub@status.im" +LABEL description="Adjusted Nix Docker image for use with Jenkins" diff --git a/nix/Makefile b/nix/Makefile new file mode 100644 index 0000000..3f0b9cd --- /dev/null +++ b/nix/Makefile @@ -0,0 +1,16 @@ +NIX_VERSION = 2.2.1 +JENKINS_UID = 1001 +JENKINS_GID = 1001 + +IMAGE_TAG = jenkins +IMAGE_NAME = statusteam/nix:$(IMAGE_TAG) + +build: + docker build --squash=true \ + --build-arg="JENKINS_UID=$(JENKINS_UID)" \ + --build-arg="JENKINS_GID=$(JENKINS_GID)" \ + --build-arg="NIX_VERSION=$(NIX_VERSION)" \ + -t $(IMAGE_NAME) . + +push: build + docker push $(IMAGE_NAME) diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..26537e2 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,9 @@ +with import { }; +stdenv.mkDerivation rec { + name = "env"; + env = buildEnv { name = name; paths = buildInputs; }; + buildInputs = with pkgs; [ + bash + wget + ]; +} diff --git a/nix/nix.conf b/nix/nix.conf new file mode 100644 index 0000000..d747365 --- /dev/null +++ b/nix/nix.conf @@ -0,0 +1,2 @@ +extra-substituters = https://nix-cache.status.im +trusted-public-keys = nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=