[object Object]

← back to Exo

ci: build all Nix outputs on all platforms and push to cachix

3bfffd9b4f6e35d8eec9885770e7944022e8c752 · 2026-01-12 17:48:11 +0000 · Jake Hillion

The CI was only running `nix flake check` on ubuntu-latest, missing
builds for other platforms and not caching packages or devShells.

Added a matrix-based `nix-build` job that runs on macos-26 (aarch64-darwin),
ubuntu-latest (x86_64-linux), and ubuntu-24.04-arm (aarch64-linux). Each
job enumerates all packages and devShells via `nix flake show --json`,
builds them in a single `nix build` call for parallelization, then runs
`nix flake check`. The cachix-action pushes all built outputs automatically.

This ensures all Nix outputs are built and cached for every supported
platform, speeding up local development and CI runs.

Test plan:
- Tested jq enumeration command locally, correctly outputs devShell paths
- Verified xargs pipeline works with the enumerated outputs

Files touched

Diff

commit 3bfffd9b4f6e35d8eec9885770e7944022e8c752
Author: Jake Hillion <jake@hillion.co.uk>
Date:   Mon Jan 12 17:48:11 2026 +0000

    ci: build all Nix outputs on all platforms and push to cachix
    
    The CI was only running `nix flake check` on ubuntu-latest, missing
    builds for other platforms and not caching packages or devShells.
    
    Added a matrix-based `nix-build` job that runs on macos-26 (aarch64-darwin),
    ubuntu-latest (x86_64-linux), and ubuntu-24.04-arm (aarch64-linux). Each
    job enumerates all packages and devShells via `nix flake show --json`,
    builds them in a single `nix build` call for parallelization, then runs
    `nix flake check`. The cachix-action pushes all built outputs automatically.
    
    This ensures all Nix outputs are built and cached for every supported
    platform, speeding up local development and CI runs.
    
    Test plan:
    - Tested jq enumeration command locally, correctly outputs devShell paths
    - Verified xargs pipeline works with the enumerated outputs
---
 .github/workflows/pipeline.yml | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index af4a67e3..9fbad631 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -94,9 +94,19 @@ jobs:
 
       - uses: ./.github/actions/typecheck
 
-  nix-flake-check:
-    name: Check Nix flake
-    runs-on: ubuntu-latest
+  nix:
+    name: Build and check (${{ matrix.system }})
+    runs-on: ${{ matrix.runner }}
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - runner: macos-26
+            system: aarch64-darwin
+          - runner: ubuntu-latest
+            system: x86_64-linux
+          - runner: ubuntu-24.04-arm
+            system: aarch64-linux
     steps:
       - name: Checkout repository
         uses: actions/checkout@v4
@@ -113,10 +123,17 @@ jobs:
           name: exo
           authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
 
-      - name: Run nix flake check
+      - name: Build all Nix outputs
         run: |
-          nix flake check
-        shell: bash
+          nix flake show --json | jq -r '
+            [
+              (.packages."${{ matrix.system }}" // {} | keys[] | ".#packages.${{ matrix.system }}.\(.)"),
+              (.devShells."${{ matrix.system }}" // {} | keys[] | ".#devShells.${{ matrix.system }}.\(.)")
+            ] | .[]
+          ' | xargs nix build
+
+      - name: Run nix flake check
+        run: nix flake check
 
 #  ci:
 #    needs: typecheck

← 007eb800 nix: enable cachix  ·  back to Exo  ·  ci: remove old commented out job b968d6f0 →