summaryrefslogtreecommitdiffhomepage
path: root/nix/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'nix/scripts')
-rwxr-xr-xnix/scripts/update-hashes.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/nix/scripts/update-hashes.sh b/nix/scripts/update-hashes.sh
index 7bf183c5b..22c556363 100755
--- a/nix/scripts/update-hashes.sh
+++ b/nix/scripts/update-hashes.sh
@@ -33,9 +33,16 @@ trap cleanup EXIT
write_node_modules_hash() {
local value="$1"
+ local system="${2:-$SYSTEM}"
local temp
temp=$(mktemp)
- jq --arg value "$value" '.nodeModules = $value' "$HASH_FILE" >"$temp"
+
+ if jq -e '.nodeModules | type == "object"' "$HASH_FILE" >/dev/null 2>&1; then
+ jq --arg system "$system" --arg value "$value" '.nodeModules[$system] = $value' "$HASH_FILE" >"$temp"
+ else
+ jq --arg system "$system" --arg value "$value" '.nodeModules = {($system): $value}' "$HASH_FILE" >"$temp"
+ fi
+
mv "$temp" "$HASH_FILE"
}