diff --git a/.github/workflows/build-machines-and-homes.yml b/.github/workflows/build-machines-and-homes.yml index 741aa70..4e45c05 100644 --- a/.github/workflows/build-machines-and-homes.yml +++ b/.github/workflows/build-machines-and-homes.yml @@ -42,6 +42,23 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + - name: Restore and cache Nix store + uses: nix-community/cache-nix-action@v5.1.0 + with: + # restore and save a cache using this key + primary-key: nix-${{ runner.os }}-${{ matrix.machine }}-${{ hashFiles('**/*.nix', 'flake.lock') }} + # if there's no cache hit, restore a cache by this prefix + restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.machine }}- + # do purge caches + purge: true + # purge all versions of the cache + purge-prefixes: nix-${{ runner.os }}- + # created more than this number of seconds ago relative to the start of the `Post Restore` phase + purge-last-accessed: 86400 + # except the version with the `primary-key`, if it exists + purge-primary-key: never + # always save the cache + save-always: true - name: setup attic run: | nix profile install github:zhaofengli/attic @@ -85,6 +102,23 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + - name: Restore and cache Nix store + uses: nix-community/cache-nix-action@v5.1.0 + with: + # restore and save a cache using this key + primary-key: nix-${{ runner.os }}-${{ matrix.home }}-${{ hashFiles('**/*.nix', 'flake.lock') }} + # if there's no cache hit, restore a cache by this prefix + restore-prefixes-first-match: nix-${{ runner.os }}-${{ matrix.home }}- + # do purge caches + purge: true + # purge all versions of the cache + purge-prefixes: nix-${{ runner.os }}- + # created more than this number of seconds ago relative to the start of the `Post Restore` phase + purge-last-accessed: 86400 + # except the version with the `primary-key`, if it exists + purge-primary-key: never + # always save the cache + save-always: true - name: setup attic run: | nix profile install github:zhaofengli/attic diff --git a/flake.nix b/flake.nix index 63877d3..024c157 100644 --- a/flake.nix +++ b/flake.nix @@ -160,7 +160,7 @@ config.allowUnfree = true; system = "x86_64-linux"; overlays = [ - inputs.lix-module.overlays.default + inputs.lix-modules.overlays.default inputs.rust-overlay.overlays.default inputs.vscode-extensions.overlays.default ] ++ (import ./overlay { inherit inputs; });