Reusable action for Nix CI with caching: - DeterminateSystems/nix-installer-action for Nix installation - actions/cache@v4 for Nix store caching - Cache key based on flake.lock for per-repo isolation
26 lines
645 B
YAML
26 lines
645 B
YAML
name: 'Nix Setup with Cache'
|
|
description: 'Install Nix and set up store caching'
|
|
|
|
inputs:
|
|
cache-name:
|
|
description: 'Optional cache name prefix for disambiguation'
|
|
required: false
|
|
default: ''
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Install Nix
|
|
uses: DeterminateSystems/nix-installer-action@main
|
|
|
|
- name: Cache Nix store
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
/nix/store
|
|
/nix/var/nix
|
|
~/.cache/nix
|
|
key: nix-${{ inputs.cache-name }}${{ runner.os }}-${{ hashFiles('flake.lock') }}
|
|
restore-keys: |
|
|
nix-${{ inputs.cache-name }}${{ runner.os }}-
|