CI/Nix: add cache-nix-action

Use nixbuild/nix-quick-install-action which pairs well with
nix-community/cache-nix-action.

Should help with build times by reducing the number of packages needing
to be re-downloaded on each run.

Parameters are taken from https://github.com/nix-community/cache-nix-action
and may be tweaked later.
This commit is contained in:
Mihai Fufezan 2025-06-20 01:34:57 +03:00
parent 8844ac1336
commit 400308fc4f
No known key found for this signature in database

View File

@ -1,15 +1,33 @@
name: Build xdph (Nix)
on: [push, pull_request, workflow_dispatch]
'on':
- push
- pull_request
- workflow_dispatch
jobs:
nix:
name: "Build"
name: Build
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v27
- name: Build xdg-desktop-portal-hyprland
run: nix build --print-build-logs --extra-substituters "https://hyprland.cachix.org"
- name: Clone repository
uses: actions/checkout@v3
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v31
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save 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: Build xdg-desktop-portal-hyprland
run: >-
nix build --print-build-logs --extra-substituters
"https://hyprland.cachix.org"