Skip to content

Irrigation

Irrigation #52

Workflow file for this run

name: Irrigation
on:
workflow_dispatch:
jobs:
generate-matrix:
name: "Generate host matrix"
runs-on: self-hosted
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run flake checks
run: nix flake check
- name: List NixOS configurations
id: set-matrix
env:
EXCLUDE_HOSTS: "zinnia"
run: |
exclude_pattern=$(echo "$EXCLUDE_HOSTS" | tr ',' '\n' | sed 's/^/^/; s/$/$/' | paste -sd'|' -)
hosts=$(find nixosConfigurations -type f -name '*.nix' \
| sed -E 's|nixosConfigurations/||; s/\.nix$//' \
| grep -Ev "$exclude_pattern" \
| nix run nixpkgs#jq -- -R -s -c 'split("\n") | map(select(length > 0)) | {hostname: .}')
echo "matrix=$hosts"
echo "matrix=$hosts" >> $GITHUB_OUTPUT
deploy:
needs: generate-matrix
name: Deploy system to ${{ matrix.hostname }}
runs-on: self-hosted
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Deploy
run: |
nix shell nixpkgs#openssh nixpkgs#deploy-rs -c deploy --ssh-opts "-o StrictHostKeyChecking=no" -s .#${{ matrix.hostname }}