ci: push attic to binary cache, update nix script

This commit is contained in:
Matthias Ahouansou 2024-05-01 21:54:32 +01:00
parent 3b7c001350
commit 0b217232ac
No known key found for this signature in database
2 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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