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
|
# Find all output paths of the installables and their build dependencies
|
||||||
readarray -t derivations < <(nix path-info --derivation "$@")
|
readarray -t derivations < <(nix path-info --derivation "$@")
|
||||||
cache=()
|
readarray -t cache < <(
|
||||||
for derivation in "${derivations[@]}"; do
|
xargs \
|
||||||
cache+=(
|
nix-store --query --requisites --include-outputs \
|
||||||
"$(nix-store --query --requisites --include-outputs "$derivation")"
|
<<< "${derivations[*]}"
|
||||||
)
|
)
|
||||||
done
|
|
||||||
|
|
||||||
# Upload them to Attic
|
# Upload them to Attic
|
||||||
#
|
#
|
||||||
|
|
@ -62,12 +61,12 @@ ci() {
|
||||||
|
|
||||||
# Build and cache all the package outputs
|
# Build and cache all the package outputs
|
||||||
packages() {
|
packages() {
|
||||||
declare -a cache="($(
|
readarray -t cache < <(
|
||||||
nix flake show --json 2> /dev/null |
|
nix flake show --json 2> /dev/null |
|
||||||
nix run --inputs-from "$toplevel" nixpkgs#jq -- \
|
nix run --inputs-from "$toplevel" nixpkgs#jq -- \
|
||||||
-r \
|
-r \
|
||||||
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | @sh'
|
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | .[]'
|
||||||
))"
|
)
|
||||||
|
|
||||||
just "${cache[@]}"
|
just "${cache[@]}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue