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.
On Avrea runners
Section titled “On Avrea runners”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:
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 .#defaultManual setup
Section titled “Manual setup”- 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