Repository navigation
fix(scaffold): default direnv to flake-generated pre-commit hooks - #1168
Merged
Merged
Conversation
The direnv CI lane runs on the bare host runner (resolve-toolchain emits an
empty container image), which lacks the devkit image's FHS loader and C++
runtime that the hand-managed .pre-commit-config.yaml's pymarkdown hook (native
pyjson5) needs — so pymarkdown fails with ImportError: libstdc++.so.6 there.
A fresh direnv scaffold now activates an empty `hooks = { }` in flake.nix and
drops the hand-managed YAML, so the shared flake hook set generates the config
(dropping pymarkdown, which is not in nixpkgs) and runs host-side. The generated
store-symlink config is gitignored from the first scaffold.
Gated on a fresh scaffold: a consumer's own preserved flake.nix or committed
.pre-commit-config.yaml is never rewritten. Container/both keep the hand-managed
YAML (they run inside the image where pymarkdown works). bare is out of scope —
it prunes flake.nix and the consumer owns its own toolchain.
Refs: #1167
This was referenced Jul 17, 2026
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 #1167.
A fresh
direnvscaffold now defaults to flake-generated pre-commit hooks instead of the hand-managed.pre-commit-config.yaml.Why
The
direnv(andbare) CI lanes run on the bare host runner —resolve-toolchainemits an empty containerimage, so the job runs directly on the runner rather than inside the devkit image. The image ships the FHS dynamic loader + C++ runtime that the scaffolded YAML'spymarkdownhook needs (its nativepyjson5); the host runner does not, so the hook fails withImportError: libstdc++.so.6. Both existing direnv consumers (commit-action, sync-issues-action) had already switched to flake-generated hooks by hand. Observed during the 1.3.1 rollout onvig-os/org-config.What changed
assets/init-workspace.sh: on a freshdirenvscaffold, activate an emptyhooks = { };inflake.nix(deterministic single insert after the uniqueextraPackagesline) and drop the seeded.pre-commit-config.yaml. The shared flake hook set then generates the config as a/nix/storesymlink, which is gitignored from the first scaffold (render_gitignoregains aFLAKE_HOOKS_DEFAULTpath so the ignore is seeded before the symlink exists).flake.nixor committed.pre-commit-config.yamlis never rewritten.container/bothkeep the hand-managed YAML (they run inside the image wherepymarkdownworks);bareships noflake.nix(it prunes it) and the consumer owns its own toolchain there.docs/MIGRATION.mdpre-commit opt-in section + residual note;CHANGELOG.md.Testing
tests/bats/init-workspace.bats(drop YAML, activate hooks, gitignore seed; container/both keep YAML + opt-in; consumer files preserved).init-workspace.batssuite green (218 tests);test_scaffold_lint.py+test_install_script.pygreen.flake.nixpassesnix-instantiate --parseand isnixfmt --checkclean.pre-commit run --all-filesgreen.Refs: #1167