Repository navigation
feat(scaffold): nix consumer support — detection, gitignore fragment, statix/deadnix hooks - #1176
Merged
Merged
Conversation
… linters RED for #1171: a nix-oriented consumer (*.nix beyond the scaffold-managed ./flake.nix) gets the nix gitignore fragment (result/result-*); a flake.nix-only consumer stays undetected (re-scaffold safety); the CodeQL matrix is untouched (nix is not a CodeQL language); statix and deadnix render on the flake-generated consumer surface only, and the scaffolded template flake.nix passes both linters with the configured flags. Refs: #1171
A repo is nix-oriented when it carries *.nix files beyond the scaffold-managed ./flake.nix (excluding .git/, .direnv/, .worktrees/) — flake.nix alone would false-positive on every direnv consumer at re-scaffold time. Detected nix repos append the new assets/gitignore.d/nix.gitignore fragment (result, result-*); the fragment feeds the #1145 managed set via the existing all-fragments glob. nix is not a CodeQL language, so render_codeql_matrix omits the leg (same treatment as rust). Refs: #1171
Define statix and deadnix in nix/hooks.nix hookDefs as consumer-only
language: system hooks (no yaml render, scaffold = false): they appear
in mkProjectShell's flake-generated .pre-commit-config.yaml but never
in the committed hand-managed YAMLs, so existing container-mode
consumers see zero change. statix runs single-target (statix check .,
pass_filenames = false); deadnix runs with --fail --no-lambda-arg
--no-lambda-pattern-names so the scaffolded consumer flake.nix passes
out of the box. Devkit's own authored-flake-scoped checks.{statix,
deadnix} gates keep their strict defaults, untouched.
Refs: #1171
c-vigo
marked this pull request as ready for review
July 17, 2026 11:24
c-vigo
added a commit
that referenced
this pull request
Jul 17, 2026
## Summary Closes #1170. Packages `pymarkdownlnt` 0.9.23 in the flake (`nix/pymarkdown.nix`: pymarkdownlnt + its two PyPI-only pure-Python deps `application-properties` 0.9.3 and `columnar` 1.4.1; the native `pyjson5` comes from nixpkgs) and promotes the `pymarkdown` hook from a runner-only remote-repo hook to a `language: system` hook across **all three** artifacts (committed runner YAML, sandbox `checks.pre-commit` gate, consumer flake-generated surface). This retires the documented "pymarkdown residual" — the reason direnv consumers lost markdown linting after #1167/#1168 — and unblocks the direnv-only deployment of exo-pet/vault (a markdown documentation vault). - Built against `python314` (toolchain default); all three packages are pure Python and pass `pythonImportsCheck`. - `remoteRepos.pymarkdown` pin and its `repoOrder` entry removed; both committed `.pre-commit-config.yaml`s re-rendered to the system-hook form. - "Drops pymarkdown / not in nixpkgs" messaging retired in `assets/init-workspace.sh`, `docs/NIX.md`, `docs/MIGRATION.md`, and the #1167 bats assertions. - **Deliberate deviation from the issue text:** the sandbox gate mirrors the hook in `fix` mode (on the sandboxed copy, fail-on-modify — same semantics as the ruff/end-of-file-fixer gates and identical to the runner), not `scan`: scan is strictly stricter and would fail the gate on pre-existing MD013 line-length debt, an out-of-scope behavior change. Documented in the hookDef comment. ## Verification - TDD: RED `d76dbcc7` → GREEN `bf1c866a` → docs `98db437e`. - `pymarkdown version` → 0.9.23 in the dev shell; `nix build .#checks.x86_64-linux.pre-commit` → gate builds and passes — re-run by the reviewing session. - `pytest tests/test_flake_hooks.py tests/test_flake_devshell.py` → 40 passed, 1 skipped (re-run by the reviewing session); bats #1167 direnv-hooks tests 6/6. - Full `prek run --all-files` in the dev shell: green (pymarkdown runs over all markdown), working tree clean (re-run by the reviewing session). - Strict `buildEnv` collision probe (pymarkdown + pythonEnv) assembles cleanly; the full image build is left to CI. ## Notes - The NixOS-only `LD_LIBRARY_PATH` libstdc++ shim is no longer strictly needed for pymarkdown but is left in place (general safety net, minimal diff). - Expect CHANGELOG (+ mirror) and `nix/hooks.nix`/test-file merge conflicts with sibling PRs #1174/#1175/#1176 — union-merge as usual.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1171.
Makes Nix a first-class consumer language in the scaffold (ask-gate cleared by three nix-oriented consumers: exo-pet/exo-fleet, Personal/vigo-nixos, devkit itself):
assets/init-workspace.sh): a repo is nix-oriented when it carries*.nixfiles beyond the scaffold-managed./flake.nix(pruning.git/,.direnv/,.worktrees/).flake.nixalone can't be the marker — every direnv scaffold ships one, so naive detection would false-positive on every direnv consumer at re-scaffold. Deterministic and re-scaffold-safe.assets/gitignore.d/nix.gitignore):result,result-*. The [BUG] #1111 gitignore migration leaks scaffold-committed files (.envrc) and language-template junk into .gitignore.project #1145 managed set already derives from ALL gitignore.d fragments, so no migration-logic change was needed (existing [BUG] #1111 gitignore migration leaks scaffold-committed files (.envrc) and language-template junk into .gitignore.project #1145 tests stay green).nix/hooks.nix):language: systemhookDefs withscaffold = falseand noyaml— both committed hand-managed YAMLs are byte-unchanged (guarded by the drift gates + an explicit test); the hooks render only into the flake-generated consumer config. statix runscheck .repo-wide (single-target CLI, respects .gitignore); deadnix runs--fail --no-lambda-arg --no-lambda-pattern-namesso the scaffolded template flake.nix (idiomatic{ self, … }pattern,extraPackages = pkgs: [ ]seed) passes out of the box — proven by a test that runs the exact rendered hook entries against a template copy. Devkit's own strict internal gates (checks.{statix,deadnix}) are untouched.nix) : ;;no-op arm (nix is not a CodeQL language, same as rust), with a bats test proving the matrix stays['actions']-only for a pure-nix consumer.Verification
77fb07ac(1 bats + 4 pytest failing pre-implementation; two deliberate green guards) →e49d99c8(detection + fragment) →492ac467(hooks).bats tests/bats/init-workspace.bats→ 221/221;pytest tests/test_flake_hooks.py→ 27 passed — both re-run by the reviewing session.statix check assets/workspace/flake.nixanddeadnix --fail --no-lambda-arg --no-lambda-pattern-names assets/workspace/flake.nixboth clean.prek run --all-filesin the dev shell: green, working tree clean (re-run by the reviewing session).Notes
hooks.deadnix.entryoverrides.