From b029ebe4251bb5b6136409d30780508f286471db Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Mon, 19 Feb 2024 14:37:31 +0100 Subject: [PATCH] Cache nix store by nixpkgs hash as a key --- .github/workflows/deploy.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 8fdef70..2e914e8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -26,11 +26,16 @@ jobs: with: nix_path: nixpkgs=channel:nixpkgs-23.11-darwin + - name: Extract nixpkgs hash + run: | + nixpkgs_hash=$(grep -o -P '(?<=archive/)[0-9a-f]{40}(?=\.tar\.gz)' shell.nix) + echo "NIXPKGS_HASH=$nixpkgs_hash" >> $GITHUB_ENV + - name: Cache Nix store uses: actions/cache@v4 id: nix-cache with: - key: nix-${{ runner.os }}-${{ hashFiles('shell.nix') }} + key: nix-${{ runner.os }}-${{ env.NIXPKGS_HASH }} path: /tmp/nix-cache - name: Import Nix store cache