Repository navigation
feat(hooks): package pymarkdown and promote it to a system hook - #1177
Merged
Merged
Conversation
Package pymarkdownlnt (nix/pymarkdown.nix) with its two PyPI-only pure-Python deps not in nixpkgs (application-properties, columnar); pyjson5 comes from nixpkgs. Add it to the toolchain SSoT (nix/devtools.nix) so it reaches the dev-shell, image, and vigos.packages home module. Convert the pymarkdown hookDef in nix/hooks.nix from a runner-only remote-repo hook to a language: system hook rendered in all three artifacts: the committed runner + scaffold YAML, the sandbox checks.pre-commit gate, and the consumer generation surface. All run `-c .pymarkdown fix` with the same excludes; the gate operates on the sandbox source copy so fix never mutates the real tree. Drop the now unused remoteRepos.pymarkdown pin and its repoOrder entry. Refs: #1170
pymarkdown is now packaged in the flake and rendered as a language: system hook in all three artifacts (#1170), so the "not in nixpkgs / drops pymarkdown" rationale is stale. Update the direnv flake-hooks default messaging in assets/init-workspace.sh (and its bats comment), the residual notes in docs/NIX.md and docs/MIGRATION.md, and record the change under CHANGELOG Unreleased -> Added. The direnv default mechanism stays; its rationale is now that the flake set resolves every hook from the Nix store rather than building the committed YAML remote pre-commit repo hook envs per runner. Refs: #1170
c-vigo
marked this pull request as ready for review
July 17, 2026 11:35
This was referenced Jul 17, 2026
c-vigo
added a commit
that referenced
this pull request
Jul 17, 2026
## Summary Closes #1178. Adds the `docs` capability module (`nix/modules/docs.nix`): document-oriented consumers opt in with `mkProjectShell { modules = [ "docs" ]; }` and get `typst` + `typstyle` on the dev-shell PATH. First consumer: exo-pet/vault (direnv-only deployment in the current wave); qms and EXOMA presentation/grant repos share the profile — the ADR's ask-gate is met. - v1 contract per ADR-capability-modules: packages only, no version knob — nixpkgs ships a single typst per pin, so the module tracks the toolchain pin (typst output isn't version-stable; a consumer's `generated/` artifacts regenerate once at migration). - Deliberate v1 exclusions documented in `docs/NIX.md` and the module header: pandoc/LaTeX (ask-gated), headless drawio/excalidraw export (electron-shaped, repo-owned), Python doc libs (pymupdf4llm/openpyxl → consumer `pyproject.toml` via uv). - Registered in `nix/modules/default.nix`; geant4/rust/fortran/root stay deferred. ## Verification - TDD: RED `779252c3` (missing `module-docs` check attr) → GREEN `29ed4844` → docs `455aa3f8`; merge of dev (post-#1177) `5bb9d9dc` clean, no conflicts. - `pytest tests/test_flake_modules.py` → 9 passed (re-run by the reviewing session after the dev merge). - Through the modules path (`nix develop .#checks…module-docs`): `typst 0.14.2`, `typstyle 0.14.4` — proven from the module's own purity-isolated shell, not devkit's own devshell (re-run by the reviewing session). - Full `prek run --all-files` green (incl. the new pymarkdown system hook from #1177), working tree clean.
c-vigo
added a commit
that referenced
this pull request
Jul 17, 2026
…1184) ## What & why On a non-Python **direnv-mode** consumer, the CI preamble keeps the Nix CPython on `PATH` (the manylinux exclusion of #1028 only applies when `pyproject.toml` exists). A `uvx`-run tool whose manylinux native wheel links `libstdc++.so.6` then aborts with `libstdc++.so.6: cannot open shared object file`, because the Nix loader does not search `/usr/lib` — the same failure class as the dropped `pymarkdown`/`pyjson5` hook. Fixes #1181. ## Approach Ship the proven org-config pattern as a **base justfile helper** rather than a global preamble export or a change to `setup-devkit-toolchain` (owned by #1180). The root `assets/workspace/justfile` gains a `with-native-libs +command` recipe: - Lives in the **root** justfile so it is reachable in **every** delivery mode (direnv/bare have no `.devcontainer/justfile.devc`) — direnv-mode CI is exactly the case that needs it. - Derives a **command-scoped** `LD_LIBRARY_PATH` from `$VIGOS_STDCPP_LIB` (dev-shell export) or, failing that, from the on-`PATH` `cc` wrapper via `cc -print-file-name=libstdc++.so.6` (the wrapper is on the preamble-forwarded PATH; `cc` echoes the bare name back — not an absolute path — when it cannot resolve the lib, so the leading-`/` check degrades to a no-op). - Scoped to the one wrapped command, so the Nix `libstdc++` never leaks into other tools' processes; degrades to the caller's own `LD_LIBRARY_PATH` (or empty) when neither source resolves. A consumer recipe wraps its tool: ```just validate: just with-native-libs uvx --from [email protected] otterdog validate --local ``` ## Provenance & evidence - Mirrors the consumer-side fix proven in **org-config@f01175a** (vig-os/org-config#40), reproduced under a CI-faithful `env -i PATH=<store bins>` simulation. - TDD: failing bats test committed first, then the recipe. New coverage in `tests/bats/just.bats` exercises all branches: - derives `LD_LIBRARY_PATH` from the on-PATH `cc` wrapper, - prefers `$VIGOS_STDCPP_LIB` over deriving from `cc`, - no-ops cleanly when the lib is not found, - prepends to an existing `LD_LIBRARY_PATH`. - `bats tests/bats/just.bats`: **51/51 pass** (5 new). `prek run --all-files`: **fully green**. ## Scope Minimal diff — root justfile helper, its bats coverage, changelog (+ synced `.devcontainer/` mirror), and NIX.md docs. Does **not** touch `setup-devkit-toolchain` (#1180) and does **not** resurrect the pymarkdown hook (nix-packaged separately in #1177). ## Review fix: no empty LD_LIBRARY_PATH entries Review found an edge case: when nothing resolved the libstdc++ dir (no `$VIGOS_STDCPP_LIB`, `cc` absent or lib not found) the recipe still composed the prefix, yielding `:/pre/existing` when the caller had an `LD_LIBRARY_PATH` (a leading empty entry = **cwd** on the dynamic loader's search path — a tool run from an untrusted directory could load a planted `libstdc++.so.6`), or setting the variable to `""` when it did not. Fixed (TDD, RED then GREEN): the recipe now branches on a non-empty prefix and otherwise runs the command with the environment **untouched** — never a leading colon, never set-to-empty. New bats coverage asserts the caller's value passes through byte-identical and that the variable stays unset in the pure no-op case. After the fix: `bats tests/bats/just.bats` **52/52 pass**, `prek run --all-files` fully green. Refs: #1181, vig-os/org-config#40
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 #1170.
Packages
pymarkdownlnt0.9.23 in the flake (nix/pymarkdown.nix: pymarkdownlnt + its two PyPI-only pure-Python depsapplication-properties0.9.3 andcolumnar1.4.1; the nativepyjson5comes from nixpkgs) and promotes thepymarkdownhook from a runner-only remote-repo hook to alanguage: systemhook across all three artifacts (committed runner YAML, sandboxchecks.pre-commitgate, 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).python314(toolchain default); all three packages are pure Python and passpythonImportsCheck.remoteRepos.pymarkdownpin and itsrepoOrderentry removed; both committed.pre-commit-config.yamls re-rendered to the system-hook form.assets/init-workspace.sh,docs/NIX.md,docs/MIGRATION.md, and the direnv-mode scaffold ships hand-managed pre-commit config whose pymarkdown hook cannot run on host runners #1167 bats assertions.fixmode (on the sandboxed copy, fail-on-modify — same semantics as the ruff/end-of-file-fixer gates and identical to the runner), notscan: 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
d76dbcc7→ GREENbf1c866a→ docs98db437e.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 direnv-mode scaffold ships hand-managed pre-commit config whose pymarkdown hook cannot run on host runners #1167 direnv-hooks tests 6/6.prek run --all-filesin the dev shell: green (pymarkdown runs over all markdown), working tree clean (re-run by the reviewing session).buildEnvcollision probe (pymarkdown + pythonEnv) assembles cleanly; the full image build is left to CI.Notes
LD_LIBRARY_PATHlibstdc++ shim is no longer strictly needed for pymarkdown but is left in place (general safety net, minimal diff).nix/hooks.nix/test-file merge conflicts with sibling PRs feat(ci): route scaffolded ci.yml jobs to self-hosted runners via .vig-os #1174/feat(hooks): add gitleaks as an opt-in default-disabled hook #1175/feat(scaffold): nix consumer support — detection, gitignore fragment, statix/deadnix hooks #1176 — union-merge as usual.