Skip to content

Nix Binary Cache

Avrea provides a Nix binary cache endpoint that acts as a substituter. Store paths built on one run are available to all subsequent runs without rebuilding.

The Nix substituter needs to be configured after Nix is installed, because install-nix-action overwrites nix.conf. Add a step to append the cache configuration:

workflow.yml
jobs:
build:
runs-on: avrea-ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Configure Avrea nix binary cache
run: |
cat << 'NIXCONF' | sudo tee -a /etc/nix/nix.conf > /dev/null
trusted-users = root runner
substituters = http://avrea-host:8290/nix-build/cache https://cache.nixos.org
trusted-substituters = http://avrea-host:8290/nix-build/cache https://cache.nixos.org
require-sigs = false
NIXCONF
sudo systemctl restart nix-daemon
- name: Build
run: nix build --no-link .#default
- name: Push to Avrea binary cache
run: nix copy --to http://avrea-host:8290/nix-build/cache .#default
- name: Configure Avrea nix binary cache
run: |
cat << 'NIXCONF' | sudo tee -a /etc/nix/nix.conf > /dev/null
trusted-users = root runner
substituters = http://avrea-host:8290/nix-build/cache https://cache.nixos.org
trusted-substituters = http://avrea-host:8290/nix-build/cache https://cache.nixos.org
require-sigs = false
NIXCONF
sudo systemctl restart nix-daemon
- run: nix build --no-link .#default
- run: nix copy --to http://avrea-host:8290/nix-build/cache .#default