mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 02:18:12 +09:00
79 lines
2.0 KiB
YAML
79 lines
2.0 KiB
YAML
name: NixOS eval
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- ".github/workflows/nixos-eval.yml"
|
|
- "flake.lock"
|
|
- "flake.nix"
|
|
- "flake/**"
|
|
- "hosts/**"
|
|
- "modules/**"
|
|
- "overlays/**"
|
|
- "profiles/**"
|
|
- "shells/**"
|
|
- ".sops.yaml"
|
|
- "secrets/**"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
discover-hosts:
|
|
name: Discover NixOS hosts
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
hosts: ${{ steps.hosts.outputs.hosts }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- 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=${{ github.token }}
|
|
|
|
- name: Evaluate NixOS hosts
|
|
id: hosts
|
|
run: |
|
|
set -euo pipefail
|
|
hosts_json=$(nix eval --json '.#nixosConfigurations' --apply 'configs: builtins.attrNames configs')
|
|
echo "hosts=${hosts_json}" >> "$GITHUB_OUTPUT"
|
|
echo "Discovered hosts: ${hosts_json}"
|
|
|
|
eval-host:
|
|
name: Eval ${{ matrix.host }}
|
|
needs: discover-hosts
|
|
if: ${{ needs.discover-hosts.outputs.hosts != '[]' }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
host: ${{ fromJSON(needs.discover-hosts.outputs.hosts) }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- 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=${{ github.token }}
|
|
|
|
- name: Evaluate NixOS system derivation
|
|
run: |
|
|
set -euo pipefail
|
|
nix eval ".#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel.drvPath"
|