From 400308fc4f9d12e0a93e483c2e7a649e12af1a92 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 20 Jun 2025 01:34:57 +0300 Subject: [PATCH] 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. --- .github/workflows/nix-build.yaml | 38 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nix-build.yaml b/.github/workflows/nix-build.yaml index b538f21..c093987 100644 --- a/.github/workflows/nix-build.yaml +++ b/.github/workflows/nix-build.yaml @@ -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"