Skip to content

Trace how each package of a package set was made - #131

Merged
clhodapp merged 2 commits into
mainfrom
feat/package-trace
Oct 24, 2026
Merged

clhodapp merged 2 commits into
mainfrom
feat/package-trace

Conversation

@clhodapp

Copy link
Copy Markdown
Contributor

This is item 6 of what topside needs from the record, the trace that topside package reads (design section 8, Tracking). nixpkgs keeps no link from an override's result to what it overrode, so the trace is recorded while a set is built.

  • traced on a package config. The manifest of a package config gains traced.children.nixpkgs.<system>: the same sets, built on the same lib, with callPackageWith replaced by a version that records each call (lib-overlays/nixpkgs/trace.nix). Only an inspection reads it, so an ordinary evaluation builds no traced set.
  • caissonTrace on each package. Every derivation a traced callPackage returns carries caissonTrace: the step, from (the derivation it was applied to), the names the step was given, and the position of the argument set the caller wrote. The callPackage at the bottom also records the function's file, the arguments that came from the scope, and the set as { config; system; }. override, overrideAttrs and overrideDerivation on a traced derivation trace what they return.
  • Unchanged derivations. The trace is attributes beside the derivation, so every drvPath stays the same.
  • lib.caisson.nixpkgs.traceChainOf reads a trace as plain data, from the last step down to the callPackage, with each derivation given by its drvPath.

Where this differs from the design. Section 8 describes the trace as a forced lib layer, caisson-core.trace, added when the whole tree is recomposed. Since #128, a package set's lib takes customisation, and with it callPackageWith, from the package set's own source. A layer in the composed lib would not reach the set, so the trace applies where a package set's lib is assembled, after that split, in the nixpkgs integration. The trace covers the packages of a package config's sets. Recomposing a whole tree, for a flake output's package, is not part of this.

Tests. nixpkgs-pkg-sets checks that a traced hello has the drvPath of the untraced one. It checks that the bottom record names …/hello/package.nix, stdenv among the scope arguments, and the set. It checks that (hello.override { }).overrideAttrs … traces as overrideAttrs, override, callPackage, with each from and the final drvPath matching the untraced chain. Reordering the expected chain makes the test fail. The full nix flake check passes, including the VM tests and the evaluation-cost gate.

🤖 Generated with Claude Code

A package config gains traced: the same sets, built on the same lib
with callPackageWith replaced by a version that records each call.
Every derivation a traced callPackage returns carries caissonTrace:
the step, the derivation it was applied to, the names it was given and
the position of the argument set the caller wrote; the callPackage at
the bottom also names the file of the function, the arguments that
came from the scope and the set. override, overrideAttrs and
overrideDerivation on a traced derivation trace what they return. The
trace is attributes beside the derivation, so drvPaths are unchanged,
and only an inspection builds a traced set. traceChainOf reads a trace
as plain data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clhodapp
clhodapp merged commit 1df1f36 into main Oct 24, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant