Skip to content

feat: cache provisioned VM images for faster creates#23

Merged
ethannortharc merged 1 commit intomainfrom
feat/image-caching
Mar 11, 2026
Merged

feat: cache provisioned VM images for faster creates#23
ethannortharc merged 1 commit intomainfrom
feat/image-caching

Conversation

@ethannortharc
Copy link
Copy Markdown
Owner

Summary

  • After first devbox create, the fully-provisioned VM is cached as a reusable image
  • Subsequent creates with the same tool set launch from cache (~10s vs ~5min)
  • Cache key = hash of (image_type + sets + languages + mount_mode + nix config files)
  • Changing any nix set file automatically invalidates the cache
  • Incus: incus publish / incus launch from cached alias
  • Lima: copies diffdisk to ~/.devbox/cache/ (APFS clone for instant, zero-cost copy)
  • Docker/Multipass: no-op (default trait stubs)
  • post_cache_setup() re-applies host-specific config (git, devbox binary, state file)

Test plan

  • cargo build — clean, no warnings
  • cargo test — all 71 tests pass (4 new cache key tests)
  • First devbox create on Incus — provisions normally, then caches
  • Second devbox create with same tools — launches from cache, skips provisioning
  • First devbox create on Lima — provisions normally, then caches
  • Second devbox create with same tools on Lima — launches from cache

🤖 Generated with Claude Code

After first `devbox create`, the fully-provisioned VM is cached as a
reusable image. Subsequent creates with the same tool set launch from
cache (~10s) instead of re-provisioning from scratch (~5min).

Cache key = hash(image_type + sets + languages + mount_mode + nix config).
Changing any nix set file automatically invalidates the cache.

- Incus: uses native `incus publish`/`incus launch` from cached alias
- Lima: copies diffdisk to ~/.devbox/cache/ (APFS clone for zero-cost)
- Docker/Multipass: no-op (default trait stubs)
- post_cache_setup() applies host-specific config (git, devbox binary)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ethannortharc ethannortharc merged commit 3aae4b9 into main Mar 11, 2026
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