name: "ci: Build `nixosConfigurations`"
on:
workflow_dispatch:
workflow_call:
push:
tags:
- "*"
paths:
- "**.lock"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "**.lock"
- "**.nix"
env:
NIX_SHOW_STATS: 1
jobs:
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Maximize Build Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Clone Repo
uses: actions/checkout@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
accept-flake-config = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup Cachix
uses: cachix/cachix-action@v17
with:
name: maydayv7-dotfiles
authToken: "${{ secrets.CACHIX_TOKEN }}"
- name: Build Configurations
run: |
export LC_ALL=C.UTF-8
ulimit -n 2048
hosts="$(nix eval --raw '.#nixosConfigurations' \
--apply 'c: builtins.concatStringsSep " " (builtins.filter (h: h != "install") (builtins.attrNames c))')"
status=0
for host in ${hosts}
do
echo "::group::Building '${host}'"
nix build ".#nixosConfigurations.${host}.config.system.build.toplevel" \
-L --show-trace || status=1
echo "::endgroup::"
done
exit "${status}"