mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 05:18:12 +09:00
Merge pull request #21 from moons-14/codex/add-nixos-build-check-action-for-main-prs
Add NixOS eval/build GitHub Actions and unignore .github
This commit is contained in:
@@ -0,0 +1,79 @@
|
|||||||
|
name: NixOS build
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/nixos-build.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}"
|
||||||
|
|
||||||
|
build-host:
|
||||||
|
name: Build ${{ 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: Build NixOS system
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
nix build ".#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel" \
|
||||||
|
--print-build-logs
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
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"
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
!LICENSE
|
!LICENSE
|
||||||
!AGENTS.md
|
!AGENTS.md
|
||||||
|
|
||||||
|
!.github/
|
||||||
|
|
||||||
!.envrc
|
!.envrc
|
||||||
|
|
||||||
!.sops.yaml
|
!.sops.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user