Skip to content

Commit

Permalink
contrib: create container for interactive guix builds
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Jun 21, 2023
1 parent 6edea7e commit 28aa3f2
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
15 changes: 15 additions & 0 deletions contrib/guix/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax = edrevo/dockerfile-plus

FROM alpine:3.17

INCLUDE+ Dockerfile.base

ENV PATH /root/.local/bin:$PATH
RUN mkdir -p /root/.local/bin

COPY ./extras/motd.txt /etc/motd
COPY ./extras/entrypoint /root/.local/bin/entrypoint
COPY ./extras/guix-check /root/.local/bin/guix-check
COPY ./extras/guix-start /root/.local/bin/guix-start

ENTRYPOINT ["/root/.local/bin/entrypoint"]
19 changes: 19 additions & 0 deletions contrib/guix/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Note: Using 'docker compose up' will leave you hanging, you need
# to use 'docker compose run guix-alpine' to drop into an
# interactive shell

version: "3.9"
services:
guix-alpine:
network_mode: host
build:
context: '.'
dockerfile: './Dockerfile.local'
tty: true # Equivalent to -t
stdin_open: true # Equivalent to -i
privileged: true # Needed for Guix to run properly
volumes:
- "../..:/dash:rw"
- "guix-alpine-cache:/root/.cache/guix:rw"
volumes:
guix-alpine-cache:
15 changes: 15 additions & 0 deletions contrib/guix/extras/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
export LC_ALL=C
set -e -o pipefail

# Read instructions
cat /etc/motd

# Start the Guix daemon
/root/.config/guix/current/bin/guix-daemon \
--build-users-group='guixbuild' \
--substitute-urls='https://bordeaux.guix.gnu.org https://ci.guix.gnu.org' < /dev/null 2>&1 |
tee /var/log/guix.log > /dev/null &

# Hand over control
exec bash
17 changes: 17 additions & 0 deletions contrib/guix/extras/guix-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
export LC_ALL=C
set -e -o pipefail

cd /dash
COMMIT_ID=guix-build-$(git rev-parse --short=12 HEAD)

printf "Binaries:\n"
( \
SRC_PATH_PREFIX=guix-build-${COMMIT_ID}/distsrc- && \
sha256sum ${SRC_PATH_PREFIX}*/src/dash{d,-cli,-tx,-wallet}{,.exe} && \
sha256sum ${SRC_PATH_PREFIX}*/src/qt/dash-qt{,.exe} && \
sha256sum ${SRC_PATH_PREFIX}*/src/test/test_dash{,.exe} \
) | sort -k 2

printf "Archives:\n"
find guix-build-"${COMMIT_ID}"/output -type f | grep -v SHA256 | xargs sha256sum | sort -k 2
15 changes: 15 additions & 0 deletions contrib/guix/extras/guix-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
export LC_ALL=C
set -e -o pipefail

# Check if macOS SDK is present, if not, download it
if [ ! -d "/dash/depends/SDKs/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers" ]
then
curl -L https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz | tar -xz -C /dash/depends/SDKs
fi

cd /dash
git status >> /dev/null
git config --global --add safe.directory /dash

./contrib/guix/guix-build
4 changes: 4 additions & 0 deletions contrib/guix/extras/motd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#####################################################
To get started, run 'guix-start' and then calculate
hashes using 'guix-check'
#####################################################

0 comments on commit 28aa3f2

Please sign in to comment.