Test a binary cache on github

This commit is contained in:
Andreas Zweili 2022-11-30 23:39:16 +01:00
parent 9b5a334cb9
commit b7cbd2d7e6
2 changed files with 44 additions and 0 deletions

27
.github/build.yml vendored Normal file
View File

@ -0,0 +1,27 @@
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt-get install -y qemu binfmt-support qemu-user-static
- name: Enable multiarch in Docker
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/cachix-action@v12
with:
name: networkinventory
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build
run: |
./scripts/build-servers.sh

17
scripts/build-servers.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
hosts=($(echo `nix eval .#nixosConfigurations --apply 'pkgs: builtins.concatStringsSep " " (builtins.attrNames pkgs)'` | xargs ))
skip=(
"desktop-vm"
"gwyn"
"staubfinger"
)
for host in "${hosts[@]}"
do
# Check if the host is in the skip list
if [[ " ${skip[*]} " =~ " ${host} " ]];then
continue
fi
nix build .#nixosConfigurations.${host}.config.system.build.toplevel
done