2024-01-25 20:37:35 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# The first argument must be the desired installable
|
|
|
|
INSTALLABLE="$1"
|
|
|
|
|
|
|
|
# Build the installable and forward any other arguments too
|
|
|
|
nix build "$@"
|
|
|
|
|
|
|
|
if [ ! -z ${ATTIC_TOKEN+x} ]; then
|
2024-03-05 08:47:46 +01:00
|
|
|
nix run --inputs-from . attic -- \
|
|
|
|
login \
|
|
|
|
conduit \
|
|
|
|
"${ATTIC_ENDPOINT:-https://nix.computer.surgery/conduit}" \
|
2024-01-25 20:37:35 +01:00
|
|
|
"$ATTIC_TOKEN"
|
|
|
|
|
2024-03-05 21:05:50 +01:00
|
|
|
# Push the target installable and its build dependencies
|
|
|
|
nix run --inputs-from . attic -- \
|
|
|
|
push \
|
|
|
|
conduit \
|
|
|
|
"$(nix path-info "$INSTALLABLE" --derivation)" \
|
2024-01-25 20:37:35 +01:00
|
|
|
"$(nix path-info "$INSTALLABLE")"
|
|
|
|
else
|
|
|
|
echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache"
|
|
|
|
fi
|