From e00ac260722d9190de2bfb143969487aa4dfbc7a Mon Sep 17 00:00:00 2001 From: Weathercold Date: Thu, 11 Sep 2025 13:33:43 -0400 Subject: [PATCH] chore(nix/flake): update lock (#577) --- .github/workflows/update-nix-assets-hash.yaml | 31 +++++++++++++++++++ flake.lock | 6 ++-- nix/assets-hash.txt | 1 + nix/package.nix | 5 ++- nix/update-assets-hash.sh | 10 ++++++ nix/update-pnpm-deps-hash.sh | 10 +++--- 6 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/update-nix-assets-hash.yaml create mode 100644 nix/assets-hash.txt create mode 100755 nix/update-assets-hash.sh diff --git a/.github/workflows/update-nix-assets-hash.yaml b/.github/workflows/update-nix-assets-hash.yaml new file mode 100644 index 000000000..7bd052c05 --- /dev/null +++ b/.github/workflows/update-nix-assets-hash.yaml @@ -0,0 +1,31 @@ +name: Update Nix assets Hash + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'apps/stage-tamagotchi/package.json' + - 'apps/stage-tamagotchi/vite.config.ts' + +permissions: + contents: write + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v31 + with: + extra_nix_config: experimental-features = nix-command flakes + + - name: Update Hash + run: nix/update-assets-hash.sh + + - uses: stefanzweifel/git-auto-commit-action@v6 + with: + commit_message: 'chore(nix): update assets hash' + commit_author: github-actions[bot] diff --git a/flake.lock b/flake.lock index b27632ee1..a850282ed 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1755186698, - "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "lastModified": 1757487488, + "narHash": "sha256-zwE/e7CuPJUWKdvvTCB7iunV4E/+G0lKfv4kk/5Izdg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "rev": "ab0f3607a6c7486ea22229b92ed2d355f1482ee0", "type": "github" }, "original": { diff --git a/nix/assets-hash.txt b/nix/assets-hash.txt new file mode 100644 index 000000000..3fe7876af --- /dev/null +++ b/nix/assets-hash.txt @@ -0,0 +1 @@ +sha256-QDGx5sWlWwgMWvG/umkNY+Ct9i5zl+eKEJnvA2whPkY= \ No newline at end of file diff --git a/nix/package.nix b/nix/package.nix index b28b39b54..545833f33 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -27,7 +27,7 @@ rustPlatform.buildRustPackage (final: { pname = "airi"; - version = "0.7.2-beta.2"; + version = "0.7.2-beta.3"; src = ../.; @@ -72,8 +72,7 @@ rustPlatform.buildRustPackage (final: { ''; outputHashMode = "recursive"; - # To update, set it to lib.fakeHash - outputHash = "sha256-QDGx5sWlWwgMWvG/umkNY+Ct9i5zl+eKEJnvA2whPkY="; + outputHash = builtins.readFile ./assets-hash.txt; }; nativeBuildInputs = [ diff --git a/nix/update-assets-hash.sh b/nix/update-assets-hash.sh new file mode 100755 index 000000000..878a3544f --- /dev/null +++ b/nix/update-assets-hash.sh @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +set -eux + +cd "$(dirname "${BASH_SOURCE[0]}")" +# Set fake hash to trigger rebuild +echo -n "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" > assets-hash.txt +# Redirect stderr to stdout for grep while keeping printing on stderr +HASH=$(nix build ..#airi.assets 2> >(tee /dev/tty) | grep -oP 'got: +\K\S+') +echo -n $HASH > assets-hash.txt diff --git a/nix/update-pnpm-deps-hash.sh b/nix/update-pnpm-deps-hash.sh index 73c24986a..c4681ac09 100755 --- a/nix/update-pnpm-deps-hash.sh +++ b/nix/update-pnpm-deps-hash.sh @@ -2,8 +2,8 @@ set -eux -ROOT="$(dirname "$(readlink -f "$0")")" - -:> "$ROOT/pnpm-deps-hash.txt" # Clear hash -HASH=$(nix build "$ROOT/..#airi.pnpmDeps" |& grep -oP 'got: +\K\S+') -echo -n $HASH > "$ROOT/pnpm-deps-hash.txt" +cd "$(dirname "${BASH_SOURCE[0]}")" +:> pnpm-deps-hash.txt # Clear hash to trigger rebuild +# Redirect stderr to stdout for grep while keeping printing on stderr +HASH=$(nix build ..#airi.pnpmDeps 2> >(tee /dev/tty) | grep -oP 'got: +\K\S+') +echo -n $HASH > pnpm-deps-hash.txt