Skip to content

[DOCS] Formalize the native-build contract — C/C++ toolchains come from the project flake, not the image #882

Closed

Description

@c-vigo

Description

0.4.0 consumer field-validation (#639, EXOMA/hyrr) showed that uv sync hard-fails in
ghcr.io/vig-os/devcontainer:0.4.0 for any dependency without a cp314 wheel (pycatima):
the image ships no C/C++ compiler and the baked CPython sysconfig points CC/CXX at a
nix-store path absent from the runtime image (#879). The mechanical half is #879
(sanitize sysconfig so build backends fall back to PATH discovery). This issue is the
contract half: document, as official policy, where native builds belong so
consumers with native deps (Geant4, ROOT, OCCT, catima, f2py) have a supported target
instead of waiting for a fatter base image.

The contract already half-exists — docs/MIGRATION.md § "Adding tools the image does
not ship" states the image is deliberately minimal and points at
vigos.lib.mkProjectShell { extraPackages = [ … ]; } — but it is written around CLI
tools (Rust example) and says nothing about native Python sdist builds, which is
where consumers actually hit the wall. Formalize:

  1. The tiered contract, stated explicitly:
    • Pure-Python / wheel-only repos — image works as-is; nothing to do.
    • Repos with native deps (preferred path) — provide the toolchain via the project
      flake: mkProjectShell { extraPackages = [ pkgs.stdenv.cc pkgs.cmake pkgs.pkg-config … ]; }.
      Inside nix develop/direnv the stdenv exports working CC/CXX, so
      scikit-build-core/setuptools/meson-python find a real compiler regardless of the
      baked sysconfig. This is the path EXOMA/talys already validated (T4.1 — Publish-cutover to the Nix image (GATED) #639 consumer 2/2).
    • Devcontainer-mode repos with native deps (middle path — document it!) — no full
      direnv migration required: the image ships Nix with flakes enabled, so inside the
      container nix develop -c just sync (against the project flake) or ad-hoc
      nix shell nixpkgs#gcc nixpkgs#cmake -c uv sync works today. Name this explicitly
      as the interim answer for repos like hyrr while the cp314 wheel ecosystem matures.
  2. A worked example with heavyweight scientific deps — a devshell adding
    pkgs.geant4 / pkgs.root alongside the compiler, showing that a bare compiler in
    the base image would not have sufficed (native builds need headers + libs + build
    config, which only a pinned flake provides reproducibly).
  3. What we will NOT do — bake gcc/cmake into the published image (breaks the
    minimal-image stance, inflates every consumer, and still fails for anything needing
    third-party headers/libs). Record the reasoning so the request doesn't resurface
    per-consumer.
  4. CI boundary — running consumer CI inside the project devshell (so the contract
    holds in CI, not just locally) is the nix-direct CI lane, tracked in [FEATURE] Nix-direct (direnv-mode) CI lane + version-skew hardening for shipped workflows #854; this issue
    only cross-references it. Until [FEATURE] Nix-direct (direnv-mode) CI lane + version-skew hardening for shipped workflows #854 lands, devcontainer-mode CI can use the
    in-container nix develop -c form from (1c).

Documentation Type

Add new documentation

Target Files

  • docs/MIGRATION.md — extend § "Adding tools the image does not ship" into the
    explicit native-build contract (tiers, worked Geant4 example, in-container middle
    path, non-goals). Direct file, not template-generated.
  • docs/NIX.md — cross-reference from the flake-architecture side if needed.

Related Code Changes

Acceptance Criteria

Changelog Category

Changed

Additional Context

Field evidence and discussion: #639 (Phase-B downstream validation comments).
mkProjectShell is defined in flake.nix and already accepts
extraPackages; pkgs.geant4 and pkgs.root exist in nixpkgs, so the worked example
is real, not aspirational.

Refs: #879, #854, #639

Activity

  1. added
    docs
    priority:medium
    area:image
    on Jul 7, 2026
  2. added this to the 0.4.1 milestone on Jul 7, 2026
  3. added
    effort:small
    on Jul 7, 2026
  4. added 3 commits that reference this issue on Jul 7, 2026
    9e18745
    41849d3
    7c255cc
  5. c-vigo commented on Jul 8, 2026

    @c-vigo
    ContributorAuthor

    Implemented in 0.4.1 (released 2026-07-08) — see the ## [0.4.1] CHANGELOG entry. Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:imagedocseffort:smallpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions