diff --git a/bin/nix-build-and-cache b/bin/nix-build-and-cache index fe1ed381..3810cd19 100755 --- a/bin/nix-build-and-cache +++ b/bin/nix-build-and-cache @@ -15,11 +15,8 @@ just() { return fi - nix run --inputs-from . attic -- \ - login \ - "$ATTIC_SERVER" \ - "$ATTIC_ENDPOINT" \ - "$ATTIC_TOKEN" + 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 "$@") @@ -29,15 +26,13 @@ just() { <<< "${derivations[*]}" ) - # Upload them to Attic - # - # Use `xargs` and a here-string because something would probably explode if - # several thousand arguments got passed to a command at once. Hopefully no - # store paths include a newline in them. + # Upload them to Attic. It seems to insist on newlines to separate the + # paths. ( IFS=$'\n' - nix shell --inputs-from . attic -c xargs \ - attic push "$ATTIC_SERVER:$ATTIC_CACHE" <<< "${cache[*]}" + nix run --inputs-from . attic#default -- \ + push --stdin --no-closure "$ATTIC_SERVER:$ATTIC_CACHE" \ + <<< "${cache[*]}" ) }