forked from Bos55/nix-config
57 lines
1.6 KiB
YAML
57 lines
1.6 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: |
|
|
hosts="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json)"
|
|
echo "${hosts}"
|
|
echo "hostnames=${hosts}" >> $GITHUB_OUTPUT
|
|
- name: "List hosts of step"
|
|
run: |
|
|
echo "${{ steps.hosts.outputs.hostnames }}"
|
|
|
|
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 }}"
|
|
|