-
Notifications
You must be signed in to change notification settings - Fork 257
Description
What problem are you trying to solve?
I've started using devbox for a project with a fair amount of packages. Python, Node, Docker, Terraform, Yarn, etc. Whenever the package list changes, it takes a non-trivial amount of time to run 'devbox shell'. At my current project size, something around 20-30s. It seems this will just increase the more I use devbox for packages.
I ran with DEVBOX_DEBUG=1 and see this:
time=2025-07-02T22:36:35.280-07:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/nix.go:84 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/path/to/myproject/.devbox/gen/flake"
⣻ Computing the Devbox environment...
time=2025-07-02T22:36:57.969-07:00 level=DEBUG source=go.jetify.com/devbox/internal/nix/nix.go:84 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/path/to/myproject/.devbox/gen/flake" cmd.path=/run/current-system/sw/bin/nix cmd.pid=41301 cmd.code=0 cmd
✓ Computed the Devbox environment.
What solution would you like?
It seems the big problem is the print-dev-env
command. I'm not sure what would be involved in trying to optimize that. I'm not too familiar with Nix internals.
But while trying to figure out what was wrong, I noticed simply reordering the packages (no version changes) in devbox.json was enough to cause devbox to recompute the environment.
Unless I'm missing something, I feel like the order of packages shouldn't really matter. So there's probably an separate, smallish optimization possible here - cache results based on a sorted list of the packages list. That won't fix the first issue though.
Alternatives you've considered
I'm not sure what alternatives are possible, aside from not using devbox.