You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #697. The pymarkdown pre-commit hook also fails on a NixOS host,
but it is a different failure class than the standalone Rust binaries: it is a
pure-Python tool whose dependency pyjson5 ships a C extension that needs libstdc++.so.6 on the loader path, which a NixOS host does not provide outside
an FHS/nix develop environment.
This is split from #697 because the standalone binaries (ruff, typos) have
drop-in nixpkgs packages, whereas pymarkdown does not — so it needs its own
investigation and decision.
Evidence
$ uv run pre-commit run pymarkdown --all-files
File ".../pyjson5/__init__.py", line 1, in <module>
from .pyjson5 import *
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
pymarkdown is not packaged in nixpkgs (pymarkdown / python3Packages.pymarkdownlnt both absent), so the simple "add to devTools + language: system" recipe from #697 does not apply directly.
Options to investigate
Provide libstdc++ to the loader in the dev-shell — add pkgs.stdenv.cc.cc.lib and set LD_LIBRARY_PATH (or NIX_LD_LIBRARY_PATH)
in mkProjectShell so the existing manylinux pyjson5 wheel resolves its
C library. Smallest change; keeps the upstream rev: pin; mildly impure.
Package pymarkdown in the flake — buildPythonApplication from the
PyPI sdist with pyjson5 taken from nixpkgs (python3Packages.pyjson5,
built against the Nix libstdc++), exposed as a pymarkdown binary, then a language: system hook. Most hermetic / SSoT-aligned; most work; adds a
version to maintain.
Drop/replace pymarkdown — only if markdown linting can move to a
Nix-friendly tool without losing the .pymarkdown config behaviour
(likely undesirable; listed for completeness).
Leaning: Option 1 as the pragmatic unblock (and it generalises to any future
C-extension Python hook), with Option 2 as the hermetic end-state if we want pymarkdown fully off upstream wheels. Confirm during execution.
Acceptance criteria
pre-commit run pymarkdown --all-files passes in the dev-shell on a NixOS
host (no --no-verify)
Chosen mechanism documented in docs/NIX.md
CI project-checks job stays green
If the dev-shell gains libstdc++/LD_LIBRARY_PATH, a dev-shell parity
test asserts it (mirrors the existing UV_PYTHON/BATS_LIB_PATH tests)
Description
Follow-up to #697. The
pymarkdownpre-commit hook also fails on a NixOS host,but it is a different failure class than the standalone Rust binaries: it is a
pure-Python tool whose dependency
pyjson5ships a C extension that needslibstdc++.so.6on the loader path, which a NixOS host does not provide outsidean FHS/
nix developenvironment.This is split from #697 because the standalone binaries (
ruff,typos) havedrop-in
nixpkgspackages, whereaspymarkdowndoes not — so it needs its owninvestigation and decision.
Evidence
pymarkdownis not packaged innixpkgs(pymarkdown/python3Packages.pymarkdownlntboth absent), so the simple "add todevTools+language: system" recipe from #697 does not apply directly.Options to investigate
libstdc++to the loader in the dev-shell — addpkgs.stdenv.cc.cc.liband setLD_LIBRARY_PATH(orNIX_LD_LIBRARY_PATH)in
mkProjectShellso the existing manylinuxpyjson5wheel resolves itsC library. Smallest change; keeps the upstream
rev:pin; mildly impure.pymarkdownin the flake —buildPythonApplicationfrom thePyPI sdist with
pyjson5taken fromnixpkgs(python3Packages.pyjson5,built against the Nix
libstdc++), exposed as apymarkdownbinary, then alanguage: systemhook. Most hermetic / SSoT-aligned; most work; adds aversion to maintain.
nix-ld(host-level) —programs.nix-ld.enablewithlibraries = [ pkgs.stdenv.cc.cc ]makes the wheel work unchanged. Notrepo-enforceable (per-contributor system config); document as fallback. See
the alternative discussion in [BUG] pre-commit: source binary hooks (ruff, ruff-format, typos) from the flake for NixOS compatibility #697.
pymarkdown— only if markdown linting can move to aNix-friendly tool without losing the
.pymarkdownconfig behaviour(likely undesirable; listed for completeness).
Leaning: Option 1 as the pragmatic unblock (and it generalises to any future
C-extension Python hook), with Option 2 as the hermetic end-state if we want
pymarkdownfully off upstream wheels. Confirm during execution.Acceptance criteria
pre-commit run pymarkdown --all-filespasses in the dev-shell on a NixOShost (no
--no-verify)docs/NIX.mdlibstdc++/LD_LIBRARY_PATH, a dev-shell paritytest asserts it (mirrors the existing
UV_PYTHON/BATS_LIB_PATHtests)Relationship
prekrunner migration ([DISCUSSION] Migration to prek #40).Refs: #625