Skip to content

Commit 22a7955

Browse files
committed
nix fix
1 parent 6861402 commit 22a7955

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

bin/update-pnpm-hashes

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
cd "$(dirname "$0")/.."
4+
5+
nix_file="nix/packages.nix"
6+
7+
# 1. Zero out pnpmDeps.hash so the build fails with a hash mismatch.
8+
sed -i -E 's|(hash = )"sha256-[^"]*";|\1"";|' "$nix_file"
9+
10+
# 2. Build pnpmDeps; it will fail and print the expected hash.
11+
got=$(nix build .#pnpmDeps 2>&1 | grep -oP 'got:\s+\Ksha256-\S+' || true)
12+
13+
if [[ -z "$got" ]]; then
14+
echo "error: could not extract hash from build output" >&2
15+
echo " (restoring file from git)" >&2
16+
git checkout -- "$nix_file"
17+
exit 1
18+
fi
19+
20+
# 3. Write the real hash back.
21+
sed -i "s|hash = \"\";|hash = \"$got\";|" "$nix_file"
22+
23+
echo "updated pnpmDeps.hash to $got"

nix/packages.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@
8787
src = pkgs.fetchCrate {
8888
pname = "wasm-bindgen-cli";
8989
version = "0.2.121";
90-
hash = "sha256-ZOMgFNOcGkO66Jz/Z83eoIu+DIzo3Z/vq6Z5g6BDY/w=";
90+
hash = "sha256-bD5kbL9i3F9uAbmw71jomSbrVDTBmREN647NSKsFXCI=";
9191
};
9292
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
9393
inherit src;
9494
inherit (src) pname version;
95-
hash = "sha256-DPdCDPTAPBrbqLUqnCwQu1dePs9lGg85JCJOCIr9qjU=";
95+
hash = "sha256-bD5kbL9i3F9uAbmw71jomSbrVDTBmREN647NSKsFXCI=";
9696
};
9797
};
9898

@@ -474,6 +474,7 @@
474474
blit
475475
blit-release
476476
;
477+
inherit pnpmDeps;
477478
demo-image = demoImage;
478479
push-demo = pushDemo;
479480
publish-demo = publishDemo;

0 commit comments

Comments
 (0)