diff --git a/bin/nix-build-and-cache b/bin/nix-build-and-cache index 4c2a8d71..67e48ff0 100755 --- a/bin/nix-build-and-cache +++ b/bin/nix-build-and-cache @@ -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[@]}" }