simplify attic call

The comment isn't really needed since the reasoning applies to the
other instances of readarray and here-strings too, and the IFS bit is
unnecessary.
This commit is contained in:
Charles Hall 2025-07-30 09:26:34 -07:00
parent 85b9080c77
commit 7fc39b1845

View file

@ -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[*]}"
)
}