(sigil build external)
Production external-build derivation kind.
Seal schema v1 is frozen (see (sigil seal)). This module owns strict recipe decoding and the resolve/realize/fetch-output backend.
Exports
external-sourceprocedureConstruct a external-source struct.
external-source?procedureTest if a value is a external-source struct.
external-source-locationprocedureGet the location field of a external-source struct.
external-source-sha256procedureGet the sha256 field of a external-source struct.
%channel-patch--typevariableGet the sha256 field of a external-source struct.
channel-patchprocedureA patch that lives inside the signed channel tree. PATH is relative to the channel repository root and SHA256 is the patch file's content hash. The realizer reads the file from the verified tree and re-hashes it, so the patch is authenticated by the existing source-closure hash and adds no new trust surface (URL patches remain legal via external-source).
channel-patch?procedureTest if a value is a channel-patch struct.
channel-patch-pathprocedureGet the path field of a channel-patch struct.
channel-patch-sha256procedureGet the sha256 field of a channel-patch struct.
patch-input-sha256procedureThe content hash of either patch input form. Patch inputs are content-addressed regardless of where the bytes come from, so the derivation record and the store key never learn which form was used.
%external-phase--typevariableThe content hash of either patch input form. Patch inputs are content-addressed regardless of where the bytes come from, so the derivation record and the store key never learn which form was used.
external-phaseprocedureConstruct a external-phase struct.
external-phase?procedureTest if a value is a external-phase struct.
external-phase-kindprocedureGet the kind field of a external-phase struct.
external-phase-argsprocedureGet the args field of a external-phase struct.
external-phase-patchesprocedureGet the patches field of a external-phase struct.
%external-divergence--typevariableGet the patches field of a external-phase struct.
external-divergenceprocedureConstruct a external-divergence struct.
external-divergence?procedureTest if a value is a external-divergence struct.
external-divergence-file-globprocedureGet the file-glob field of a external-divergence struct.
Get the max-differing-bytes field of a external-divergence struct.
%external-dep--typevariableGet the max-differing-bytes field of a external-divergence struct.
external-depprocedureOne resolved input edge as the builder sees it: the NAME ${name} interpolates, the realized OUTPUT hash, and the SEARCH-PATHS the input declares. The output hash does not determine the search paths, so the record seals all three.
external-dep?procedureTest if a value is a external-dep struct.
external-dep-nameprocedureGet the name field of a external-dep struct.
external-dep-outputprocedureGet the output field of a external-dep struct.
external-dep-search-pathsprocedureGet the search-paths field of a external-dep struct.
%external-toolchain--typevariableGet the search-paths field of a external-dep struct.
external-toolchainprocedureThe compiler toolchain a build uses; see "Toolchains" below.
external-toolchain?procedureTest if a value is a external-toolchain struct.
external-toolchain-nameprocedureGet the name field of a external-toolchain struct.
external-toolchain-versionprocedureGet the version field of a external-toolchain struct.
external-toolchain-targetprocedureGet the target field of a external-toolchain struct.
external-toolchain-outputprocedureGet the output field of a external-toolchain struct.
external-seed-toolchainvariableThe pinned Zig toolchain shipped with the channel.
external-recipeprocedureConstruct a external-recipe struct.
external-recipe?procedureTest if a value is a external-recipe struct.
external-recipe-nameprocedureGet the name field of a external-recipe struct.
external-recipe-versionprocedureGet the version field of a external-recipe struct.
external-recipe-sourceprocedureGet the source field of a external-recipe struct.
external-recipe-buildenvprocedureGet the buildenv field of a external-recipe struct.
external-recipe-depsprocedureGet the deps field of a external-recipe struct.
external-recipe-dep-inputsprocedureGet the dep-inputs field of a external-recipe struct.
external-recipe-closureprocedureGet the closure field of a external-recipe struct.
external-recipe-build-inputsprocedureGet the build-inputs field of a external-recipe struct.
external-recipe-envprocedureGet the env field of a external-recipe struct.
external-recipe-toolchainprocedureGet the toolchain field of a external-recipe struct.
external-recipe-self-runpathprocedureGet the self-runpath field of a external-recipe struct.
external-recipe-validate-runpathprocedureGet the validate-runpath field of a external-recipe struct.
external-recipe-phasesprocedureGet the phases field of a external-recipe struct.
external-recipe-divergencesprocedureGet the divergences field of a external-recipe struct.
external-build-recordvariableConstruct the external-build Seal record: everything that decides a build's output, so that two builds with different outputs never share a derivation key. DEPS is the set of every store item the build reads besides the source and the build environment.
NAMED-DEPS, CLOSURE and BUILD-INPUTS seal each input's name and search paths along with its item, because the item alone does not determine either. CLOSURE, BUILD-INPUTS and ENV are sealed only when non-empty, which keeps records of packages without them unchanged; the parameters are still required, so a caller cannot drop one by forgetting it.
named-deps->sealsprocedureSeal parallel (inputs, store-items) lists as name/item/exports entries.
external-version-satisfies?procedureThe single external-recipe constraint implementation. Exact versions and strict same-major caret constraints are accepted; a caret never admits a version lower than its requested floor.
external-resolveprocedureresolve(name, constraint) -> recipe from the selected channel.
external-fetch-sourceprocedureFetch a source archive, verifying its SHA-256 or reusing its store item.
interpolate-argumentprocedureExpand ${out} and ${dependency-name} in one phase argument.
This runs at ARGV level, before shell-quote, so an expansion can never introduce a shell metacharacter that the quoting layer then has to survive. An interpolation of a name that is not a declared input is an error here and a refusal at sigil channel publish, so a build cannot silently depend on something its definition does not name.
builder-base-assignmentsprocedureThe builder's own assignments, as (NAME . VALUE) pairs. The names here are exactly the names a package may not set.
build-environment-assignmentsprocedureAssemble the ordered NAME=VALUE list for env -i.
PACKAGE-ENV values are interpolated like phase arguments, against the same direct dependency prefixes.
*sandbox-required-tools*variableSeed tools the assembly script invokes. Checked by name before the namespace probe runs, because a seed that no longer ships unshare would otherwise be indistinguishable from a host that forbids user namespaces -- and would silently take the degraded path for a reason that has nothing to do with the host. A missing tool must be an error, never a quieter test.
sandbox-modeprocedureWhich builder mode will this process use? -> 'namespaces | 'none
This is answered from the seed TARBALL rather than from an extracted seed directory, because P1.2 puts the answer in the derivation record and the record is built before any seed has been unpacked. The verdict is cached per process, so make-external-derivation and external-builder cannot disagree -- a record that claimed one mode while the build took the other would be a lie of exactly the kind the sandbox: field exists to prevent.
The probe asks for EVERY namespace flag the builder uses rather than a cheaper subset: a host can permit unshare -U and refuse -p, and a probe of the easy neighbour would report a sandbox we cannot build in. The spike hit the same trap from the other side -- zig version needs no procfs and zig cc does. Probe the operation you ship.
*probe-root-counter*variableA private scratch directory for the one-shot probe extraction. Not in the store: the probe runs before any store path is chosen, and its output is not an input to anything.
external-mount-optionsprocedureRead per-mount options using an open source's kernel mount ID. FDINFO and MOUNTINFO are procfs text, supplied explicitly for tests.
external-read-only-optionsprocedurePreserve every kernel-locked flag when making a bind read-only.
sandbox-assembly-scriptprocedureThe namespace assembly, as a script the SEED's shell runs inside unshare -U -r -m -n -p -f. Every tool is addressed through the seed's own bin directory: the assembler is part of the declared build environment, not the host's userland.
INPUT-BINDS is ((host-path . sandbox-path) ...) for the source, the patches and every declared dependency. Nothing else is bound, so an undeclared store item is not merely unreadable by policy -- it does not exist in the namespace at all.
external-check-host-paths!procedureAfter a sandboxed build, assert that no host-specific string reached the output. This REPLACES the build-root byte rewrite on the sandboxed path: with every host path unmounted there is nothing legitimate to normalize, and a rewrite would only hide a leak that must be an error. The check is falsifiable in the useful direction -- if some future change reintroduces a host path, this fails instead of laundering it.
output-referencesprocedure((DIGEST . FIRST-FILE) ...) for every store digest under STORE-VIEW that the tree at ROOT mentions, symlink targets included.
check-output-referencesprocedureCheck REFERENCES against what the build declared. ALLOWED and FORBIDDEN are ((store-item . description) ...). Returns the allowed items referenced, sorted.
*external-unsandboxed-outputs*variableOutputs built without the sandbox in this process, and the runtime references of each output built. external-realize persists both as store metadata.
external-assert-publishableprocedureRefuse to publish a store item that was built without the sandbox. Such an item is fine to use on the machine that built it, but its prefix, inputs and network were that machine's, so it is not a portable identity.
external-output-referencesprocedureThe runtime references recorded for a built store item, as store item names. #f for an item built before references were recorded.
*external-seeds*variableTHE BUILD SEED, hashed ONCE per invocation per path. Every derivation needs its sha256 (checked against the recipe's buildenv) and its store item. Done per derivation, that was three full hashes of the 2 MB tarball -- hash-file, then store-add-file's store-find-file, then its uncached store-verify-item -- 623 ms measured, ~0.62 of the ~0.75 s each package cost a lock that built nothing (2026-09-23). Now: one hash, the store item found by that hash through the metadata- cached check, and both remembered for the rest of the invocation, as the toolchain is. store-add-file still runs when the item is absent (a first install), and it hashes as before.
external-seed-hashes counts the hashes THIS code performs, for the test that proves "once"; external-seed-forget! is what a new invocation starts with.
external-seedprocedure(sha256 . store-path) for the seed at SEED (a resolved path).
external-default-progressprocedurerealize(recipe) -> output tree hash. Exact drv-key lookup happens in the store; store-build supplies atomic idempotent directory insertion. PROGRESS HOOK: (proc EVENT NAME VERSION START) where EVENT is 'present the output is already in the store (verified) 'building a build is about to start 'built it finished; START is its current-jiffy start 'toolchain-hashing / 'toolchain-cached (NAME, VERSION, START are #f) The default keeps what this module always printed (the two toolchain lines) and nothing else, so callers that never set a hook see no change. sigil env sets one to print a line per package.
external-challengeprocedureForce one independent rebuild and compare it to the exact drv-key item. Allowed mismatches are loud and persisted in store-owned metadata.
external-fetch-outputprocedurefetch-output(hash) -> verified store path.
named-dep->sealvariable(No description)
read-external-recipevariable(No description)
patch-sourcesvariable(No description)
external-systemvariable(No description)
external-toolchain-from-outputvariable(No description)
external-realizevariable(No description)
external-check-divergencesvariable(No description)
external-normalize-build-root!variable(No description)
external-toolchain-hashvariable(No description)
external-toolchain-forget!variable(No description)
external-seed-hash-countvariable(No description)
external-seed-add-countvariable(No description)
external-seed-forget!variable(No description)
make-inputsvariable(No description)
search-path-exportsvariable(No description)
dependency-pkgconfigvariable(No description)
phase-commandvariable(No description)
phase-markervariable(No description)
external-set-progress!variable(No description)