Repository navigation
Carry the system libraries nixpkgs' codex does not declare - #30
Merged
Merged
Conversation
jgus
requested changes
Nov 10, 2026
Comment on lines
+63
to
+71
| # nixpkgs' cargo setup hook exports the "use the system library" switch for every Rust crate that | ||
| # accepts one (nixpkgs 44cddf92c432), so codex's crates probe for a C library instead of building the | ||
| # vendored one, and nixpkgs' own codex declares none of the four its crates probe: its build dies in | ||
| # zstd-sys' build script with "The system library `libzstd` required by crate `zstd-sys` was not | ||
| # found". Upstream declares them in nixpkgs 16b463698a, which reaches a nixos channel only after it | ||
| # lands on master. Carry the same four inputs meanwhile. The predicate reads the codex that this | ||
| # flake's own nixpkgs input builds, so a consumer that follows its nixpkgs in -- which is what the | ||
| # README tells a NixOS system to do -- retires the carry at the revision it actually consumes rather | ||
| # than at whatever master had merged. |
Collaborator
There was a problem hiding this comment.
Instead of writing a novel, can you just provide a link to the upstream issue and be done?
nixpkgs' cargo hook makes codex's crates probe for system libraries that its package does not declare, so the build dies in zstd-sys' build script. Upstream declares them in NixOS/nixpkgs#584667, which a nixos channel reaches late. codexSysLibsToCarry reads the codex built from this flake's own nixpkgs input and stops evaluating once that package declares all four, so the carry cannot outlive the fix and a following consumer is gated at the revision it actually consumes.
jgus-bot
force-pushed
the
agent/codex-sys-libs
branch
from
November 10, 2026 04:09
c885622 to
be49077
Compare
jgus
reviewed
Nov 10, 2026
jgus
reviewed
Nov 10, 2026
jgus
reviewed
Nov 10, 2026
jgus
reviewed
Nov 10, 2026
Co-authored-by: Josh Gustafson <[email protected]>
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.
Why
A consumer's nightly updater (
jgus-org/nix,flake-update.serviceond1,severity critical) is red because of this flake's package. nixpkgs' cargo hook now makes every Rust crate that accepts one probe for a system library instead of building its vendored copy, so a package that does not declare that library fails where it used to succeed. Upstream's fix for codex is NixOS/nixpkgs#584667; the symptom is:The probe searches exactly the
PKG_CONFIG_PATHthe package'sbuildInputscontribute, and that list carries no zstd. One leaf, and every derivation downstream of it with it: the consumer's report was one leaf and 61 dependants.compare/f4a03c00...52ab070a14e41fae5f6f26d432e264237fd63125reportsahead— the fix is onmaster, not yet in thenixos-unstablehead that consumer follows. The carry belongs here, in the flake that builds the package: anixpkgs.overlaysentry on the consumer's package set never reaches this derivation, because this flake builds nixpkgs' package through its ownimport nixpkgs.Change
buildInputs = (oldAttrs.buildInputs or [ ]) ++ codexSysLibsToCarry;inside the existingoverrideAttrs, withcodexSysLibsnaming the same four attributes upstream adds.The carry is its own retirement test.
nixpkgsCodexCarriesSysLibsreadspkgs.codex.buildInputs— nixpkgs' own package, from the nixpkgs this flake actually evaluates — andcodexSysLibsToCarryrefuses to evaluate once that package declares all four:No date, no channel name, no script: a consumer that follows its nixpkgs into this flake — which is what the README tells a NixOS system to do — is gated at the revision it actually consumes rather than at whatever
masterhad merged, and the carry cannot outlive the fix, because keeping it stops the flake from evaluating.The predicate compares
.drvPathrather than.outPath. All four are multi-output packages, and a package set names the dev output inbuildInputswhile the package value names its first output, so an output-path comparison never matches and the gate looks inert.Verification
4fe25e12, 2026-11-06):nix eval .#packages.x86_64-linux.codex.buildInputsreturns nixpkgs' eight entries plus the carried four.16b463698a(--override-input nixpkgs github:NixOS/nixpkgs/master,7d689997): the throw above.nix flake check:all checks passed!;nix fmtis a no-op.nix build --option abort-on-warn true --override-input nixpkgs github:NixOS/nixpkgs/f4a03c008967841f2a0b3cb7c436fc6fc31671f6 .#packages.x86_64-linux.codexexits 0,/nix/store/rjvb1nnvkp5q43kgcapc2298jc0lc4ym-codex-0.167.0. That build's derivation is/nix/store/jyrf0fq4nr6wqvpsfv5qnl438v2bwsx8-codex-0.167.0.drv— the same derivation the consumer produced when it carried these four inputs on its own side, which is what makes the two forms interchangeable.Build and Checkrun 42748111975: completed / success.objdump -p bin/codexlists tenNEEDEDentries includinglibzstd.so.1,libsqlite3.soandlibonig.so.5; the same package built without them at the prior revision lists six and none of the three. The derivation'sbuildInputscarryaws-lc-5.12.0-dev,oniguruma-6.9.10-dev,sqlite-3.54.0-devandzstd-1.5.7-dev—sqliteat the consumer's version, not this flake's own lock, which confirms a following consumer is served from its own package set.Consumption
No consumer expression changes:
packages.<system>.codexis the same attribute.jgus-org/nix#436carried this workaround in that root with a script canary; it is superseded by this PR and closed, so the root needs no change of its own and picks this up on its next input refresh.