name: build_systems
on:
  workflow_dispatch:
  pull_request:
  push:
    branches: [main]
  schedule:
    - cron: "0 22 * * *"

jobs:
  build:
    name: build-${{ matrix.system }}
    runs-on: self-hosted
    strategy:
      matrix:
        system:
          - "bob"
          - "brain"
          - "jeeves"
          - "leviathan"
          - "rhapsody-in-green"
    continue-on-error: true
    steps:
      - uses: actions/checkout@v4
      - name: Build default package
        run: "nixos-rebuild build --flake ./#${{ matrix.system }}"
      - name: copy to nix-cache
        run: nix copy --accept-flake-config --to unix:///host-nix/var/nix/daemon-socket/socket .#nixosConfigurations.${{ matrix.system }}.config.system.build.toplevel
