46 lines
1.2 KiB
Bash
Executable file
46 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
|
|
# The first argument must be the desired installable
|
|
INSTALLABLE="$1"
|
|
|
|
# Build the installable and forward any other arguments too
|
|
# uses nix-output-monitor (nom) if available
|
|
if command -v nom &> /dev/null; then
|
|
nom build "$@"
|
|
else
|
|
nix build -L "$@"
|
|
fi
|
|
|
|
if [ ! -z "$ATTIC_TOKEN" ]; then
|
|
nix run --inputs-from . attic -- \
|
|
login \
|
|
conduit \
|
|
"${ATTIC_ENDPOINT:-https://attic.kennel.juneis.dog/conduit}" \
|
|
"$ATTIC_TOKEN"
|
|
|
|
# Push the target installable and its build dependencies
|
|
nix run --inputs-from . attic -- \
|
|
push \
|
|
conduit \
|
|
"$(nix path-info "$INSTALLABLE" --derivation)" \
|
|
"$(nix path-info "$INSTALLABLE")"
|
|
|
|
|
|
# push to "conduwuit" too
|
|
nix run --inputs-from . attic -- \
|
|
login \
|
|
conduwuit \
|
|
"${ATTIC_ENDPOINT:-https://attic.kennel.juneis.dog/conduwuit}" \
|
|
"$ATTIC_TOKEN"
|
|
|
|
# Push the target installable and its build dependencies
|
|
nix run --inputs-from . attic -- \
|
|
push \
|
|
conduwuit \
|
|
"$(nix path-info "$INSTALLABLE" --derivation)" \
|
|
"$(nix path-info "$INSTALLABLE")"
|
|
else
|
|
echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache"
|
|
fi
|