mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
use more readarray
The first part replaces a loop which is probably a performance improvement, and the second part addresses a shellcheck complaint about not declaring and assigning separately.
This commit is contained in:
parent
27667911ed
commit
cf4f2fe51b
1 changed files with 8 additions and 9 deletions
|
|
@ -25,12 +25,11 @@ just() {
|
|||
|
||||
# Find all output paths of the installables and their build dependencies
|
||||
readarray -t derivations < <(nix path-info --derivation "$@")
|
||||
cache=()
|
||||
for derivation in "${derivations[@]}"; do
|
||||
cache+=(
|
||||
"$(nix-store --query --requisites --include-outputs "$derivation")"
|
||||
)
|
||||
done
|
||||
readarray -t cache < <(
|
||||
xargs \
|
||||
nix-store --query --requisites --include-outputs \
|
||||
<<< "${derivations[*]}"
|
||||
)
|
||||
|
||||
# Upload them to Attic
|
||||
#
|
||||
|
|
@ -62,12 +61,12 @@ ci() {
|
|||
|
||||
# Build and cache all the package outputs
|
||||
packages() {
|
||||
declare -a cache="($(
|
||||
readarray -t cache < <(
|
||||
nix flake show --json 2> /dev/null |
|
||||
nix run --inputs-from "$toplevel" nixpkgs#jq -- \
|
||||
-r \
|
||||
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | @sh'
|
||||
))"
|
||||
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | .[]'
|
||||
)
|
||||
|
||||
just "${cache[@]}"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue