From 34c07a9551717b1db8181ca20d353b8a1d3a2ef0 Mon Sep 17 00:00:00 2001 From: Hakula Chen Date: Sun, 6 Dec 2026 14:15:07 +0800 Subject: [PATCH] fix(ci): include flake.lock in rust-cache key When a consumer upgrades nixpkgs while keeping rust-toolchain.toml pinned, Swatinem/rust-cache@v2 restores the previous NixOS release target/ directory because Cargo.lock and rustc -Vv are unchanged. Cached build-script binaries then fail on Linux with ENOENT due to stale /nix/store glibc PT_INTERP paths. Include hashFiles('flake.lock') in the rust-cache key for both the main and MSRV jobs so Nix toolchain or glibc changes invalidate the Cargo cache. --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 388d7d4..2bd0b8e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -70,6 +70,7 @@ jobs: uses: Swatinem/rust-cache@v2 with: cmd-format: nix develop -c {0} + key: ${{ hashFiles('flake.lock') }} save-if: >- ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} @@ -132,6 +133,7 @@ jobs: uses: Swatinem/rust-cache@v2 with: cmd-format: nix develop .#msrv -c {0} + key: ${{ hashFiles('flake.lock') }} save-if: >- ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}