Skip to content

pack: resolve every component from the devShell closure, not the store - #16

Merged
cavearr merged 1 commit into
mainfrom
feat/pack-resolve-from-closure
Sep 15, 2026
Merged

cavearr merged 1 commit into
mainfrom
feat/pack-resolve-from-closure

Conversation

@cavearr

@cavearr cavearr commented Sep 15, 2026

Copy link
Copy Markdown
Member

Replaces the /nix/store glob (nix_locate, first match) with resolution from what the .#pack devShell actually links: python packages via the shell interpreter, libffi via the shipped _ctypes,
libantlr4-runtime via the fasm parser objects, libuuid as before. Package byte-identical to main on linux (5562 files) and macOS (5558); L1 37/37 with the release bins; darwin E2E 3/3; 148 tests.

nix_locate() globbed /nix/store and took the first match, which is a
property of the build HOST's store and not of this flake: on a store
holding more than one version of a component, the first match can be a
stranger.  libuuid.so.1 already bit that way (af36611: a util-linux
built against a newer glibc); the same shape remained for the antlr
runtime ("antl" matches any antlr in the store), libffi, prjxray (older
builds of other revisions sit in long-lived stores; measured on the dev
mac: four prjxray outputs, the first glob match not the shell's one
and every python package (a version hardcoded in the glob breaks on any
nixpkgs bump; two pyyaml versions already coexist on the dev mac).

Every component is now resolved from what the .#pack devShell actually
links:

* python packages (fasm, textx, yaml, simplejson, intervaltree,
  sortedcontainers, prjxray): importlib.util.find_spec() on the shell's
  own interpreter -- the shellHook's PYTHONPATH points at the
  site-packages of the closure, so what it resolves is by construction
  what the shell linked.  copy_python_dep() drops its version argument
  (and its import-name special case) with it.
* libffi: the DT_NEEDED/LC_LOAD_DYLIB of the _ctypes extension of the
  python3.12 the package ships.  The name filter is _ctypes. with the
  dot: lib-dynload also carries _ctypes_test, which links no libffi.
* libantlr4-runtime: scanned across the native objects of the fasm
  package's parser/ -- which of them carries the dependency differs by
  platform (the cython extension dlopens libparse_fasm).
* libuuid.so.1: unchanged, still resolved through the antlr library.

resolve_needed() generalizes the libuuid helper into needed_deps()
(ldd on Linux, otool -L via macpack._otool_deps on Darwin) with a regex
fullmatch, and nix_locate() is removed rather than kept as a fallback:
every former caller now has a closure answer, and a store-glob fallback
would reintroduce the silent stranger-picking this commit removes.
EOF
)
@cavearr
cavearr merged commit d20d2b1 into main Sep 15, 2026
8 checks passed
@cavearr
cavearr deleted the feat/pack-resolve-from-closure branch September 15, 2026 06:22
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