Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/actions/setup-nix/action.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: "Setup Nix"
description: "Install Nix and configure Cachix"
description: "Install Nix and configure cache"
runs:
using: "composite"
steps:
- name: Install Nix
uses: cachix/install-nix-action@0b0e072294b088b73964f1d72dfdac0951439dbd # v31.8.4
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
with:
github_access_token: ${{ github.token }}

- name: Setup Cachix (numtide)
uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
- name: Cache Nix store
uses: nix-community/cache-nix-action@b426b118b6dc86d6952988d396aa7c6b09776d08 # v7
with:
name: numtide
authToken: ""
primary-key: nix-${{ runner.os }}
Copy link

Copilot AI Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key nix-${{ runner.os }} is too broad and doesn't include any dependency fingerprint. This means:

  1. The cache won't be invalidated when flake.lock changes, potentially causing builds to use stale dependencies
  2. Different jobs with different Nix store requirements will share the same cache, leading to cache thrashing

Consider including a hash of flake.lock in the key, such as nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}, or use restore-keys to fall back to the OS-only key. The cache-nix-action documentation recommends including input hashes for proper cache invalidation.

Suggested change
primary-key: nix-${{ runner.os }}
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
fallback-key: nix-${{ runner.os }}

Copilot uses AI. Check for mistakes.
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Cache key should include a hash of Nix dependency files to ensure cache invalidation when dependencies change. Without this, updates to flake.lock won't trigger cache refresh, potentially causing CI to use stale dependencies.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/actions/setup-nix/action.yaml, line 14:

<comment>Cache key should include a hash of Nix dependency files to ensure cache invalidation when dependencies change. Without this, updates to `flake.lock` won&#39;t trigger cache refresh, potentially causing CI to use stale dependencies.</comment>

<file context>
@@ -1,18 +1,17 @@
       with:
-        name: numtide
-        authToken: &quot;&quot;
+        primary-key: nix-${{ runner.os }}
 
     - name: Load Nix development environment
</file context>
Suggested change
primary-key: nix-${{ runner.os }}
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', 'flake.nix') }}
Fix with Cubic


- name: Load Nix development environment
shell: bash
Expand Down