Skip to content

Commit

Permalink
Cache nix store by nixpkgs hash as a key
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaczero committed Feb 19, 2024
1 parent 36bacb8 commit b029ebe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b029ebe

Please sign in to comment.