From 47c210d5deb8d26728a6098bcfc3f8ef01b68065 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Wed, 30 Jul 2025 09:40:08 -0700 Subject: [PATCH] reorder attic token check --- bin/nix-build-and-cache | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/nix-build-and-cache b/bin/nix-build-and-cache index 3810cd19..c0969a24 100755 --- a/bin/nix-build-and-cache +++ b/bin/nix-build-and-cache @@ -10,14 +10,6 @@ just() { nix build "$@" fi - if [ -z ${ATTIC_TOKEN+x} ]; then - echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache" - return - fi - - nix run --inputs-from . attic#default -- \ - login "$ATTIC_SERVER" "$ATTIC_ENDPOINT" "$ATTIC_TOKEN" - # Find all output paths of the installables and their build dependencies readarray -t derivations < <(nix path-info --derivation "$@") readarray -t cache < <( @@ -26,6 +18,14 @@ just() { <<< "${derivations[*]}" ) + if [ -z ${ATTIC_TOKEN+x} ]; then + echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache" + return + fi + + nix run --inputs-from . attic#default -- \ + login "$ATTIC_SERVER" "$ATTIC_ENDPOINT" "$ATTIC_TOKEN" + # Upload them to Attic. It seems to insist on newlines to separate the # paths. (