Skip to content

Commit 0327ce0

Browse files
Merge pull request #207 from loss-and-quick/ci/nix-fmt-check
ci: gate nix formatting on the treefmt flake check
2 parents a0f3b8f + bd3c116 commit 0327ce0

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,37 @@ jobs:
226226
- name: Build the desktop package
227227
run: nix build .#kasumi-desktop --accept-flake-config --print-build-logs
228228

229+
# ── Formatting gate for the nix expressions. The rust (`cargo fmt`), frontend
230+
# (`biome`), and shell (`shellcheck`) jobs each cover their own tree, but nothing
231+
# checked the `.nix` files — so alejandra/statix/deadnix drift (see #206, which
232+
# reformatted every expression) could land unnoticed. This realises the flake's
233+
# own treefmt check derivation: the exact `nix fmt` config, no duplicated
234+
# formatter list. treefmt runs all its formatters, but the nix ones are the only
235+
# CI gap it closes, so it's path-gated on the nix expressions like nix-build. ──
236+
nix-fmt:
237+
needs: changes
238+
if: needs.changes.outputs.nix == 'true'
239+
runs-on: ubuntu-latest
240+
steps:
241+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
242+
with:
243+
fetch-depth: 0
244+
245+
- name: Install Nix
246+
uses: DeterminateSystems/nix-installer-action@da36cb69b1c3247ad7a1f931ebfd954a1105ef14 # v14
247+
with:
248+
extra-conf: |
249+
accept-flake-config = true
250+
251+
- name: Cachix
252+
uses: cachix/cachix-action@5f2d7c5294214f71b873db4b969586b980625e71 # v17
253+
with:
254+
name: kasumi-proxy
255+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
256+
257+
- name: treefmt check (fails on any unformatted file)
258+
run: nix build .#checks.x86_64-linux.treefmt --accept-flake-config --print-build-logs
259+
229260
# ── Desktop compile smoke (Linux + Windows) on the plain rustup toolchain — the
230261
# path release/nightly actually bundle with (the nix `nix-build` job realises the
231262
# flake package; this proves the non-nix one). Compile-only (no bundle): catches
@@ -325,7 +356,7 @@ jobs:
325356
# failure or cancellation fails CI. Point branch protection at THIS context so
326357
# path-skipped jobs never block a merge. ──
327358
ci:
328-
needs: [changes, frontend, shellcheck, rust, nix-build, desktop-linux, desktop-windows]
359+
needs: [changes, frontend, shellcheck, rust, nix-build, nix-fmt, desktop-linux, desktop-windows]
329360
if: always()
330361
runs-on: ubuntu-latest
331362
steps:

0 commit comments

Comments
 (0)