From 25eee32a222f681a950e957cc00a1ed5ac002582 Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Sun, 8 Dec 2024 21:14:17 +0100 Subject: [PATCH] feat(scripts): introduce manual push script This way, we can send some closures if some of our members build them on more powerful machines. Signed-off-by: Ryan Lahfa --- scripts/push-to-cache.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 scripts/push-to-cache.sh diff --git a/scripts/push-to-cache.sh b/scripts/push-to-cache.sh new file mode 100755 index 0000000..cc34cbb --- /dev/null +++ b/scripts/push-to-cache.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail +shopt -s lastpipe + +output_path="$1" + +if [ "$STORE_ENDPOINT" == "" ]; then + echo "No endpoint given for the remote cache, uploading cannot take place." + exit 0 +fi + +if [ "$STORE_USER" == "" ]; then + echo "No user given for the remote cache, uploading cannot take place." + exit 0 +fi + +if [ "$STORE_PASSWORD" == "" ]; then + echo "No password given for the remote cache, uploading cannot take place." + exit 1 +fi + +cat <.netrc +default +login $STORE_USER +password $STORE_PASSWORD +EOF + +nix copy \ + --extra-experimental-features nix-command \ + --to "$STORE_ENDPOINT?compression=none" \ + --netrc-file .netrc \ + "$output_path" + +rm .netrc