From c4d0d34807f98ab49d86c9c96d150d98ee8e6124 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 23 Apr 2024 12:03:16 +0200 Subject: [PATCH] ci: revert cache-nix-action to version 4.0.3 --- .forgejo/workflows/check.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/check.yml b/.forgejo/workflows/check.yml index 0a088ff4..5b755270 100644 --- a/.forgejo/workflows/check.yml +++ b/.forgejo/workflows/check.yml @@ -24,20 +24,20 @@ jobs: echo "hash=$(md5sum flake.lock | awk '{print $1}')" >> $GITHUB_OUTPUT - name: Restore and cache Nix store - uses: https://github.com/nix-community/cache-nix-action@v5 + uses: https://github.com/nix-community/cache-nix-action@v4.0.3 id: nix-store-cache with: - primary-key: cache-${{ runner.os }}-nix-store-${{ steps.flake-lock-hash.outputs.hash }} - restore-prefixes-first-match: | + key: cache-${{ runner.os }}-nix-store-${{ steps.flake-lock-hash.outputs.hash }} + restore-keys: | cache-${{ runner.os }}-nix-store- gc-linux: true gc-max-store-size-linux: 10000000000 - purge: true - purge-prefixes: cache-${{ runner.os }}-nix-store- - purge-created: 42 - purge-primary-key: never + purge-caches: true + purge-key: cache-${{ runner.os }}-nix-store- + purge-created: true + purge-created-max-age: 42 - name: Prepare cachix uses: https://github.com/cachix/cachix-action@v14 @@ -49,3 +49,12 @@ jobs: - name: Run flake checks run: | nix --print-build-logs --verbose --accept-flake-config --access-tokens '' flake check + # Prevent cache garbage collection + for target in $(nix flake show --json --all-systems | jq ' + .["nixosConfigurations"] | + to_entries[] | + .key + ' | tr -d '"' + ); do + nix profile install --profile "/nix/var/nix/profiles/$target" ".#nixosConfigurations.${target}.config.system.build.toplevel" + done