This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

pkgs.photocraft-web: 0.1.1 -> 0.8.2, add updateScript

+80 -3
+8 -3
pkgs/photocraft-web/package.nix
··· 28 28 in 29 29 rustPlatform.buildRustPackage (finalAttrs: { 30 30 pname = "photocraft-web"; 31 - version = "0.1.1"; 31 + version = "0.8.2"; 32 32 33 33 src = fetchFromGitHub { 34 34 owner = "storytold"; 35 35 repo = "photocraft"; 36 36 tag = "v${finalAttrs.version}"; 37 - hash = "sha256-lyhQ+kewBiZSNx/w/e6RO4dTKZmDD5hnsDSEKkKrtt0="; 37 + hash = "sha256-kqKpZ8IBPmCd93XXvyxyAjPjJEWFfZh49qQc9KMSp4Y="; 38 38 }; 39 39 40 - cargoHash = "sha256-MLECpUx0J0RjxHXbhhR1WK8iajiNU+gJeZBsyZZwxg4="; 40 + cargoHash = "sha256-dafKVsoBYuChW0nsjUhk5GqCChAO07A4Rhhv2UAdEx0="; 41 41 42 42 nativeBuildInputs = [ 43 43 trunk ··· 63 63 cp -r dist/web $out 64 64 runHook postInstall 65 65 ''; 66 + 67 + passthru = { 68 + inherit wasm-bindgen-cli; 69 + updateScript = ./update.sh; 70 + }; 66 71 67 72 meta = { 68 73 description = "PhotoCraft image editor compiled to WebAssembly, as a static site";
+72
pkgs/photocraft-web/update.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + # Bumps photocraft to the latest GitHub release and keeps the bundled 5 + # wasm-bindgen-cli in lockstep with the wasm-bindgen version in Cargo.lock 6 + # (trunk refuses mismatched versions), so nix-update alone is not enough. 7 + owner=storytold 8 + repo=photocraft 9 + attr=photocraft-web 10 + 11 + # Run by update-pkgs from the flake root ($0 is a read-only store copy). 12 + pkg=pkgs/photocraft-web/package.nix 13 + system=$(nix eval --raw --impure --expr 'builtins.currentSystem') 14 + flake_attr=".#packages.$system.$attr" 15 + 16 + tag=$(curl -fsSL "https://api.github.com/repos/$owner/$repo/releases/latest" | jq -r .tag_name) 17 + new_version=${tag#v} 18 + old_version=$(nix eval --raw "$flake_attr.version") 19 + 20 + new_wb=$(curl -fsSL "https://raw.githubusercontent.com/$owner/$repo/$tag/Cargo.lock" \ 21 + | awk '/^name = "wasm-bindgen"$/ && !seen { getline; gsub(/version = |"/, ""); print; seen = 1 }') 22 + old_wb=$(nix eval --raw "$flake_attr.wasm-bindgen-cli.version") 23 + if [ -z "$new_wb" ]; then 24 + echo "$attr: could not find wasm-bindgen in Cargo.lock of $tag" >&2 25 + exit 1 26 + fi 27 + 28 + if [ "$old_version" = "$new_version" ] && [ "$old_wb" = "$new_wb" ]; then 29 + echo "$attr: already up to date ($new_version, wasm-bindgen $new_wb)" 30 + exit 0 31 + fi 32 + 33 + # Blank every hash we bump, otherwise nix reuses the cached old FODs. 34 + sed -i \ 35 + -e "/pname = \"$attr\"/,/version = /s|version = \"[^\"]*\"|version = \"$new_version\"|" \ 36 + -e "/repo = \"$repo\"/,/hash = /s|hash = \"[^\"]*\"|hash = \"\"|" \ 37 + -e "s|cargoHash = \"[^\"]*\"|cargoHash = \"\"|" \ 38 + "$pkg" 39 + if [ "$old_wb" != "$new_wb" ]; then 40 + sed -i \ 41 + -e "/pname = \"wasm-bindgen-cli\"/,/hash = /s|version = \"[^\"]*\"|version = \"$new_wb\"|" \ 42 + -e "/pname = \"wasm-bindgen-cli\"/,/hash = /s|hash = \"[^\"]*\"|hash = \"\"|" \ 43 + -e "/fetchCargoVendor/,/hash = /s|hash = \"[^\"]*\"|hash = \"\"|" \ 44 + "$pkg" 45 + fi 46 + 47 + # The probe build is *expected* to fail (hash mismatch); `|| true` keeps 48 + # pipefail/errexit from turning that into an empty `got`. 49 + probe_hash() { 50 + { nix build --no-link "$flake_attr.$1" 2>&1 || true; } | tee /dev/stderr \ 51 + | awk '/got:/ && !seen { print $2; seen = 1 }' || true 52 + } 53 + 54 + # fill <sub-attr> <sed address range start> <field> 55 + fill() { 56 + local got 57 + got=$(probe_hash "$1") 58 + if [ -n "$got" ]; then 59 + sed -i "$2,/$3 = /s|$3 = \"[^\"]*\"|$3 = \"$got\"|" "$pkg" 60 + echo "$attr: $1 → $got" 61 + fi 62 + } 63 + 64 + if [ "$old_wb" != "$new_wb" ]; then 65 + fill wasm-bindgen-cli.src '/pname = "wasm-bindgen-cli"/' hash 66 + fill wasm-bindgen-cli.cargoDeps '/fetchCargoVendor/' hash 67 + fi 68 + fill src "/repo = \"$repo\"/" hash 69 + fill cargoDeps '/cargoHash/' cargoHash 70 + 71 + echo "$attr: updated $old_version → $new_version (wasm-bindgen $old_wb → $new_wb)" 72 + nix build --no-link "$flake_attr"