1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-12-29 12:24:34 +01:00
conduit/bin/nix-build-and-cache

32 lines
822 B
Text
Raw Normal View History

2024-05-05 09:53:53 +02:00
#!/usr/bin/env sh
set -euo pipefail
# 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 -- \
login \
conduit \
2024-04-28 18:10:25 +02:00
"${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 \
"${outputs[@]}" \
"${derivations[@]}"
else
echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache"
fi