name: Refresh Nix Cache

on:
  push:
    branches: [ 'main' ]
    paths:
      - flake.lock
      - Cargo.lock
  workflow_dispatch:

permissions: {}

jobs:
  nix-cache:
    name: Refresh Nix Cache
    runs-on: ubuntu-24.04
    timeout-minutes: 10

    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          persist-credentials: false

      - name: Install Nix
        uses: nixbuild/nix-quick-install-action@v34

      - name: Build Wild
        run: |
          nix build -L --show-trace

      - name: Cache Nix store
        uses: nix-community/cache-nix-action/save@v7
        id: cache
        with:
          primary-key: ${{ runner.os }}-${{ hashFiles( 'flake.lock', 'Cargo.lock' ) }}

