From 534f84419c5f5ee0ca6a7b9f7e9b2cfa7c8d2a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Fri, 1 Mar 2019 17:11:06 +0100 Subject: [PATCH] add modified nix image for use with jenkins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- nix/Dockerfile | 20 ++++++++++++++++++++ nix/Makefile | 16 ++++++++++++++++ nix/default.nix | 9 +++++++++ nix/nix.conf | 2 ++ 4 files changed, 47 insertions(+) create mode 100644 nix/Dockerfile create mode 100644 nix/Makefile create mode 100644 nix/default.nix create mode 100644 nix/nix.conf 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=