2024-05-05 11:28:48 +03:00
|
|
|
#!/usr/bin/env bash
|
2024-01-25 22:37:35 +03:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2024-05-01 23:54:32 +03:00
|
|
|
# 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
|
2024-01-25 22:37:35 +03:00
|
|
|
|
|
|
|
if [ ! -z ${ATTIC_TOKEN+x} ]; then
|
2024-03-05 10:47:46 +03:00
|
|
|
nix run --inputs-from . attic -- \
|
|
|
|
login \
|
|
|
|
conduit \
|
2024-04-28 19:10:25 +03:00
|
|
|
"${ATTIC_ENDPOINT:-https://attic.conduit.rs/conduit}" \
|
2024-01-25 22:37:35 +03:00
|
|
|
"$ATTIC_TOKEN"
|
|
|
|
|
2024-05-01 23:54:32 +03:00
|
|
|
readarray -t outputs < <(nix path-info "$@")
|
|
|
|
readarray -t derivations < <(nix path-info "$@" --derivation)
|
|
|
|
|
2024-03-05 23:05:50 +03:00
|
|
|
# Push the target installable and its build dependencies
|
|
|
|
nix run --inputs-from . attic -- \
|
|
|
|
push \
|
|
|
|
conduit \
|
2024-05-01 23:54:32 +03:00
|
|
|
"${outputs[@]}" \
|
|
|
|
"${derivations[@]}"
|
2024-01-25 22:37:35 +03:00
|
|
|
else
|
|
|
|
echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache"
|
|
|
|
fi
|