Fix gh actions nix caching #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build with nix | |
| on: [push, pull_request, workflow_dispatch] | |
| permissions: | |
| actions: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: nixbuild/nix-quick-install-action@v31 | |
| with: | |
| nix_conf: | | |
| keep-env-derivations = true | |
| keep-outputs = true | |
| - name: Cache nix store | |
| uses: nix-community/cache-nix-action@v6 | |
| with: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | |
| restore-prefixes-first-match: nix-${{ runner.os }}- | |
| gc-max-store-size-linux: 1G | |
| purge: true | |
| purge-prefixes: nix-${{ runner.os }}- | |
| purge-created: 0 | |
| purge-last-accessed: 0 | |
| purge-primary-key: never | |
| - name: Check nix flake | |
| run: nix flake check | |
| - name: Build backend with nix | |
| run: nix build .#backend | |
| - name: Upload built nix package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend | |
| path: ./result/**/* |