Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/nixos-build.yml
Original file line number Diff line number Diff line change
@@ -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
78 changes: 78 additions & 0 deletions .github/workflows/nixos-eval.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
!LICENSE
!AGENTS.md

!.github/

!.envrc

!.sops.yaml
Expand Down
Loading