Skip to content

feat(build-img): add -P/--add-package for extra base image packages - #42

Merged
raphaelcoeffic merged 1 commit into
mainfrom
feat/build-img-add-package
Sep 10, 2026
Merged

feat(build-img): add -P/--add-package for extra base image packages#42
raphaelcoeffic merged 1 commit into
mainfrom
feat/build-img-add-package

Conversation

@raphaelcoeffic

Copy link
Copy Markdown
Owner

Summary

  • Adds a repeatable -P/--add-package flag to build-img. The packages are added to the default BASE_PACKAGES list, which is then sorted and deduplicated.
  • The final package list is written to /nix/.base.packages. It is included in the image tarball and in the base image hash.
  • pkg reads /nix/.base.packages to decide which packages are built-in, so packages added with -P show up in pkg list. pkg install refuses them as already installed, and pkg remove refuses them as built-in. Older images without the file fall back to BASE_PACKAGES.
  • Removes the unused -f/--flake-dir option. It wasn't used by the Makefile, CI, or docs.
  • Documents -P in the README's "Custom builds" section.

Testing

  • build-img -P hello -P jq --uncompressed built an image. The tarball contains .base.packages with 36 entries: the 35 defaults plus hello. jq is already a default, so it appears only once. The hello store path is in the image.
  • pkg list on a host without .base.packages lists the 35 defaults as built-in, which exercises the fallback.
  • cargo fmt --check passes. Clippy reports no new warnings (the pid_lookup.rs warning was already there).
  • Not tested: pkg list inside a real dive session using a newly built image.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XG7ZPAubVzGgDUEXVbT7Sa

Extra packages are added on top of BASE_PACKAGES. The resulting package
list is recorded in /nix/.base.packages (packaged and hashed with the
image), and `pkg` reads it to know which packages are built-in, falling
back to BASE_PACKAGES for older images.

Remove the unused --flake-dir option.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XG7ZPAubVzGgDUEXVbT7Sa
@raphaelcoeffic
raphaelcoeffic merged commit 486a399 into main Sep 10, 2026
2 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