From 3b7c00135074da4f0fa43ea11dbe0fc88a7b9fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Sun, 28 Apr 2024 18:10:25 +0200 Subject: [PATCH 1/2] ci: use attic.conduit.rs --- .gitlab-ci.yml | 4 ++-- bin/nix-build-and-cache | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c880b9c..b9dbd784 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,8 +21,8 @@ before_script: - if command -v nix > /dev/null; then echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf; fi # Add our own binary cache - - if command -v nix > /dev/null; then echo "extra-substituters = https://nix.computer.surgery/conduit" >> /etc/nix/nix.conf; fi - - if command -v nix > /dev/null; then echo "extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=" >> /etc/nix/nix.conf; fi + - if command -v nix > /dev/null; then echo "extra-substituters = https://attic.conduit.rs/conduit" >> /etc/nix/nix.conf; fi + - if command -v nix > /dev/null; then echo "extra-trusted-public-keys = conduit:ddcaWZiWm0l0IXZlO8FERRdWvEufwmd0Negl1P+c0Ns=" >> /etc/nix/nix.conf; fi # Add alternate binary cache - if command -v nix > /dev/null && [ -n "$ATTIC_ENDPOINT" ]; then echo "extra-substituters = $ATTIC_ENDPOINT" >> /etc/nix/nix.conf; fi diff --git a/bin/nix-build-and-cache b/bin/nix-build-and-cache index 350e1717..967c16ae 100755 --- a/bin/nix-build-and-cache +++ b/bin/nix-build-and-cache @@ -12,7 +12,7 @@ if [ ! -z ${ATTIC_TOKEN+x} ]; then nix run --inputs-from . attic -- \ login \ conduit \ - "${ATTIC_ENDPOINT:-https://nix.computer.surgery/conduit}" \ + "${ATTIC_ENDPOINT:-https://attic.conduit.rs/conduit}" \ "$ATTIC_TOKEN" # Push the target installable and its build dependencies From 0b217232acf268377016c9517151acd0e8c0b7e8 Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Wed, 1 May 2024 21:54:32 +0100 Subject: [PATCH 2/2] ci: push attic to binary cache, update nix script --- .gitlab-ci.yml | 3 +++ bin/nix-build-and-cache | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9dbd784..3aecebf6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,6 +49,9 @@ ci: stage: ci image: nixos/nix:2.20.4 script: + # Cache attic client + - ./bin/nix-build-and-cache --inputs-from . attic + # Cache the inputs required for the devShell - ./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation diff --git a/bin/nix-build-and-cache b/bin/nix-build-and-cache index 967c16ae..42c37709 100755 --- a/bin/nix-build-and-cache +++ b/bin/nix-build-and-cache @@ -2,11 +2,13 @@ set -euo pipefail -# The first argument must be the desired installable -INSTALLABLE="$1" - -# Build the installable and forward any other arguments too -nix build "$@" +# Build the installable and forward any other arguments too. Also, use +# nix-output-monitor instead if it's available. +if command -v nom &> /dev/null; then + nom build "$@" +else + nix build "$@" +fi if [ ! -z ${ATTIC_TOKEN+x} ]; then nix run --inputs-from . attic -- \ @@ -15,12 +17,15 @@ if [ ! -z ${ATTIC_TOKEN+x} ]; then "${ATTIC_ENDPOINT:-https://attic.conduit.rs/conduit}" \ "$ATTIC_TOKEN" + readarray -t outputs < <(nix path-info "$@") + readarray -t derivations < <(nix path-info "$@" --derivation) + # Push the target installable and its build dependencies nix run --inputs-from . attic -- \ push \ conduit \ - "$(nix path-info "$INSTALLABLE" --derivation)" \ - "$(nix path-info "$INSTALLABLE")" + "${outputs[@]}" \ + "${derivations[@]}" else echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache" fi