Skip to content

changes

changes #262

name: "NixOS Rebuild"
on:
pull_request:
paths-ignore:
- darwin-*/**
- nixos-tests/**
push:
branches:
- main
jobs:
nixos-rebuild:
strategy:
matrix:
host:
- adama
- cain
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: nixbuild/nix-quick-install-action@v28
with:
nix_conf: extra-platforms = aarch64-linux
- uses: nix-community/cache-nix-action/restore@v5
with:
primary-key: nix-nixos-${{ matrix.host }}-${{ hashFiles('**/*.nix') }}
restore-prefixes-first-match: nix-nixos-${{ matrix.host }}-
- uses: cachix/cachix-action@v15
with:
name: esselius
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: nix-community
- name: Evaluate nixos config
id: drv-check
run: |
echo -n result= >> $GITHUB_OUTPUT
nix --accept-flake-config path-info --derivation .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel | base64 -w 0 | tee /tmp/drv >> $GITHUB_OUTPUT
- uses: nix-community/cache-nix-action/save@v5
if: github.ref == 'ref/head/main'
with:
primary-key: nix-nixos-${{ matrix.host }}-${{ hashFiles('**/*.nix') }}
- uses: actions/cache@v4
id: cache-test
with:
path: /tmp/drv
key: nixos-${{ hashFiles(format('{0}/{1}.{2}', 'nixos-configurations', matrix.host, 'nix')) }}-${{ steps.drv-check.outputs.result }}
lookup-only: true
- name: Build nixos config
if: steps.cache-test.outputs.cache-hit != 'true'
run: nix --accept-flake-config build .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel