|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: [push, pull_request, workflow_dispatch] |
| 4 | +jobs: |
| 5 | + nix: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + steps: |
| 8 | + - uses: actions/checkout@v4 |
| 9 | + |
| 10 | + - name: Install Nix |
| 11 | + uses: nixbuild/nix-quick-install-action@v31 |
| 12 | + with: |
| 13 | + nix_conf: | |
| 14 | + keep-env-derivations = true |
| 15 | + keep-outputs = true |
| 16 | +
|
| 17 | + - name: Restore and save Nix store |
| 18 | + uses: nix-community/cache-nix-action@v6 |
| 19 | + with: |
| 20 | + # restore and save a cache using this key |
| 21 | + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} |
| 22 | + # if there's no cache hit, restore a cache by this prefix |
| 23 | + restore-prefixes-first-match: nix-${{ runner.os }}- |
| 24 | + # collect garbage until the Nix store size (in bytes) is at most this number |
| 25 | + # before trying to save a new cache |
| 26 | + # 1G = 1073741824 |
| 27 | + gc-max-store-size-linux: 1G |
| 28 | + # do purge caches |
| 29 | + purge: true |
| 30 | + # purge all versions of the cache |
| 31 | + purge-prefixes: nix-${{ runner.os }}- |
| 32 | + # created more than this number of seconds ago |
| 33 | + purge-created: 0 |
| 34 | + # or, last accessed more than this number of seconds ago |
| 35 | + # relative to the start of the `Post Restore and save Nix store` phase |
| 36 | + purge-last-accessed: 0 |
| 37 | + # except any version with the key that is the same as the `primary-key` |
| 38 | + purge-primary-key: never |
| 39 | + |
| 40 | + # not needed (yet) |
| 41 | + # - uses: cachix/cachix-action@v12 |
| 42 | + # with: |
| 43 | + # name: hyprland |
| 44 | + # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' |
| 45 | + |
| 46 | + - name: Build |
| 47 | + run: nix flake check --print-build-logs --keep-going |
0 commit comments