forked from Bos55/nix-config
53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
name: "Build"
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
|
|
jobs:
|
|
determine-hosts:
|
|
name: "Determining hosts to build"
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
outputs:
|
|
hosts: ${{ steps.hosts.outputs.hostnames }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: https://github.com/cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- name: "Determine hosts"
|
|
id: hosts
|
|
run: |
|
|
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json)"
|
|
printf "hostnames=%q\n" "${hostnames}" >> "${GITHUB_OUTPUT}" # Preserve quotes
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
needs: determine-hosts
|
|
strategy:
|
|
matrix:
|
|
hostname: ${{ fromJSON(needs.determine-hosts.outputs.hosts) }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: https://github.com/cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- name: "Debug needs outputs"
|
|
run: |
|
|
echo "${{ needs.determine-hosts.outputs.hosts }}"
|
|
- name: Debug Matrix
|
|
run: |
|
|
echo "The matrix value is: ${{ matrix.hostname }}"
|
|
- name: "Define host"
|
|
run: |
|
|
echo "Building for: ${{ matrix.hostname }}"
|
|
- run: |
|
|
nixos-rebuild build --flake ".#${{ matrix.hostname }}"
|
|
|