Repository navigation
docs(migration): formalize the native-build contract - #888
Merged
Merged
Conversation
Extend MIGRATION.md 'Adding tools the image does not ship' with the tiered native-build contract (wheel-only / project-flake toolchain via mkProjectShell extraPackages / in-container nix develop middle path), a worked Geant4/ROOT example, and the explicit non-goal of shipping a C/C++ toolchain in the base image. Cross-link the sysconfig mechanics (#879) and the nix-direct CI lane (#854); add a pointer from NIX.md. Refs: #882
1 task done
c-vigo
added a commit
that referenced
this pull request
Jul 7, 2026
…#893) ## Description Closes #879. In the 0.4.0 image, any `uv sync` needing a source build hard-fails: the baked CPython records its Nix build toolchain in sysconfig (`CC='gcc'`, `CXX='g++'`, and link commands starting with those names), the image ships no compiler, and PEP 517 backends inherit the phantom names verbatim — scikit-build-core exports them so CMake aborts on the missing `g++` instead of doing PATH discovery. This rewrites the first token of `CC`/`CXX`/`LINKCC`/`LDSHARED`/`BLDSHARED`/`LDCXXSHARED` to the generic POSIX `cc`/`c++` in `_sysconfigdata__*.py`, `_sysconfig_vars__*.json`, and the config `Makefile`, restoring normal PATH compiler discovery against whatever toolchain the project flake provides (see the native-build contract, #882 / PR #888) — and an honest "no compiler found" when none does. Mechanism: a last-layer shadow copy via `fakeRootCommands` — no CPython rebuild, dev-shell toolchain untouched, all python-dependent derivations stay cached; deterministic seds preserve digest reproducibility. Stale hash-based `.pyc`s (CHECKED_HASH) self-invalidate. ## Type of Change - [x] `fix` -- Bug fix ## Changes Made - `flake.nix`: `fakeRootCommands` sanitize step in the image customisation layer - `tests/test_image.py`: `test_sysconfig_compiler_vars_are_generic` — asserts generic first tokens and no `/nix/store/` leakage (TDD: committed RED first) - `CHANGELOG.md` (+ workspace mirror): Unreleased/Fixed entry ## Changelog Entry ### Fixed - **Image sysconfig no longer records the Nix build toolchain** ([#879](#879)) - `CC`/`CXX` and link commands sanitized to generic `cc`/`c++`, so PEP 517 source builds fall back to PATH compiler discovery (project-flake toolchains work; honest error otherwise) ## Testing - RED: new test failed against the unpatched image (`CC='gcc'`) - GREEN: full image test suite 114/114 passing locally after the fix, including the new test - `just precommit` full suite green Refs: #879
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.
Description
Formalize the native-build contract in
docs/MIGRATION.md: state, as officialpolicy, where C/C++ toolchains for native Python (sdist) builds come from —
the project flake, not the base image. 0.4.0 field validation (#639,
EXOMA/hyrr) showed
uv synchard-fails in the image for any dependencywithout a cp314 wheel; the mechanical half is #879, this PR documents the
contract half.
Closes #882
Type of Change
docs-- Documentation onlyModifiers
!) -- This change breaks backward compatibilityChanges Made
docs/MIGRATION.md— new "The native-build contract" subsection under"Adding tools the image does not ship":
wheel-only — image works as-is; (2) direnv mode (preferred) —
mkProjectShell { extraPackages = [ pkgs.stdenv.cc pkgs.cmake pkgs.pkg-config ]; };(3) devcontainer mode (middle path) — in-container
nix develop -c just syncor ad-hoc
nix shell nixpkgs#gcc nixpkgs#cmake -c uv sync;pkgs.geant4/pkgs.root, showing whya bare compiler in the base image would not suffice;
rationale;
T4.1 — Publish-cutover to the Nix image (GATED) #639 (field evidence).
docs/NIX.md— one-line pointer from themkProjectShelllib-output bulletto the new contract section.
CHANGELOG.md— entry under## Unreleased/### Changed(mirrorassets/workspace/.devcontainer/CHANGELOG.mdregenerated by thesync-manifest hook).
All snippets validated against the repo:
mkProjectShellinflake.nixaccepts
extraPackages ? [ ]; the pinned nixpkgs(
34268251cf5547d39063f2c5ea9a196246f7f3a6) evaluatesgeant4-11.4.1,root-6.40.00,gcc-wrapper-15.2.0(stdenv.cc),cmake-4.1.2.Changelog Entry
Changed
mkProjectShell.extraPackages/ in-containernix develop -cmiddle path), a worked Geant4/ROOT example, and the explicit non-goal of shipping a C/C++ toolchain in the base image. Cross-links #879 and #854.Testing
just test) — n/a, docs-onlyManual Testing Details
TDD not applicable: documentation-only change, no testable behavior.
Verification performed instead:
just precommit(full hook suite, all files): exit 0, 52 hooks Passed,0 Failed (includes pymarkdown, typos, sync-manifest, generate-docs).
flake.nix's actualmkProjectShellsignatureand package names evaluated against the pinned nixpkgs revision (versions
above).
Checklist
generate-docshook passed)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
in-flight fix are asserted here.
area to avoid conflicts with T4.4 — Decommission the Debian path #642 (Debian-era MIGRATION.md pruning) running
in parallel; the changelog edit is a tight 4-line insertion.
Refs: #882