fix(nix): align prebuilt runtime dependencies (#651)

Use raw release-asset hashes, keep the Nixpkgs lock current, and validate the prebuilt package across supported Nixpkgs branches and architectures.

[skip ci]
This commit is contained in:
github-actions[bot] authored and GitHub committed 2026-08-31 17:09:02 +00:00
1 parent f9f9dd8abe
commit 87f91e3c13
6 files changed
+74 -31

No files matched your search

+8 -8
View File
@@ -5,8 +5,8 @@ set -euo pipefail
release_version="${1:-}"
release_tag="${2:-}"
if git diff --quiet -- flake.nix; then
echo "flake.nix hashes are already up to date"
if git diff --quiet -- flake.nix flake.lock; then
echo "flake hashes and lock are already up to date"
exit 0
fi
@@ -21,12 +21,12 @@ fi
branch_suffix="v${version}"
title="chore: update flake hashes for v${version}"
body="Updates the Nix flake fetchzip hashes for v${version} release assets."
body="Updates the Nix flake fetchurl hashes for v${version} release assets and refreshes the Nixpkgs lock."
if [[ "$release_tag" != "v$version" ]]; then
branch_suffix="${branch_suffix}-${release_tag}"
title="chore: update flake hashes for v${version} from ${release_tag}"
body="Updates the Nix flake fetchzip hashes for v${version} using ${release_tag} release assets."
body="Updates the Nix flake fetchurl hashes for v${version} using ${release_tag} release assets and refreshes the Nixpkgs lock."
fi
git config user.name "github-actions[bot]"
@@ -37,7 +37,7 @@ if [[ "$release_tag" == "snapshot" ]]; then
source_branch_slug="$(printf '%s' "$source_branch" | sed -E 's#[/[:space:]]+#-#g; s#[^A-Za-z0-9._-]##g; s#^-+##; s#-+$##')"
branch="chore/flake-${source_branch_slug}"
git switch -C "$branch"
git add flake.nix
git add flake.nix flake.lock
git commit -m "$title"
git push --force origin "$branch"
echo "Updated snapshot flake hashes on branch $branch from $source_branch; skipping PR creation"
@@ -47,12 +47,12 @@ fi
branch="chore/update-flake-hashes-${branch_suffix}"
git switch -C "$branch"
git add flake.nix
git add flake.nix flake.lock
git commit -m "$title"
git push --force origin "$branch"
if gh pr view "$branch" --json number > /tmp/flake-pr.json 2> /dev/null; then
pr_number="$(jq -r '.number' /tmp/flake-pr.json)"
pr_number="$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')"
if [[ -n "$pr_number" ]]; then
gh pr edit "$pr_number" --title "$title" --body "$body"
else
gh pr create --title "$title" --body "$body" --base main --head "$branch"
+2 -3
View File
@@ -11,7 +11,7 @@ FLAKE_FILE="$PROJECT_DIR/flake.nix"
usage() {
echo "Usage: $0 [version] [release-tag]"
echo
echo "Updates flake.nix fetchzip hashes from the published GitHub release assets."
echo "Updates flake.nix fetchurl hashes from the published GitHub release assets."
echo "When version is omitted, the workspace package version from Cargo.toml is used."
echo "When release-tag is omitted, v<version> is used. Use snapshot to test snapshot assets."
}
@@ -22,7 +22,7 @@ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
fi
if ! command -v nix > /dev/null; then
echo "nix is required to calculate unpacked fetchzip hashes" >&2
echo "nix is required to calculate release asset hashes" >&2
exit 1
fi
@@ -61,7 +61,6 @@ prefetch_hash() {
store prefetch-file \
--hash-type sha256 \
--json \
--unpack \
"$url" \
| jq -r '.hash'; then
return 0