You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[UX] Better dedup packages we nix build, and improve UX printouts (#1827)
## Summary
We have two separate steps for "installing packages".
1. We use nix build to add to the nix store.
2. We later ensure the nix profile is updated to have items pointing to
the nix store packages.
For the first step, we should only run `nix build` if the package's
outputs are not in the nix store. For this, we check `nix store ls
<path>`. We get `<path>` from `nix path-info <installable>`.
Previously, we were checking if the packages were in the `nix profile`,
rather than directly querying the nix store. This would lead to
re-running `nix build` for when we've done `devbox add` outside a
devbox-environment, and then started a devbox-environment (example:
doing `devbox add` followed by `devbox shell`).
For the second step, we can remove the `[1/3] <package>` being removed
print outs. This was already removed for packages being added. Reason:
this step should be quick! We've already added the packages to the nix
store via `nix build`. It also confuses users who are likely not aware
of a `nix profile` concept, nor should we make them aware of it.
**Alternatives:**
Also tried `nix build --profile <path> <installable>` but this doesn't
seem to return the installed package in `nix profile list`. Not sure
why, but it doesmean its not useful for de-duplicating packages that
remain to be installed.
**Upside:**
Ths store-path deduping is great. Works much faster. Re-doing `devbox
add <package>` for a package already in `/nix/store` is much faster
since we skip the `nix build` step entirely. As it should be.
**Downside:**
A user adding or removing packages directly from editing the
`devbox.json` will not see any nice per-package-steps installation
output. (Note, this was changed when adding nix-proflile-from-flake, but
mentioning for completeness of analyzing the UX)
## How was it tested?
`devbox add` a package already in store no longer shows the per-package
installation steps
`devbox shell` subsequently does not again show we are adding the
package.
`devbox add` a package not in store does show the per-package-steps
installation output.
Need to do more rigorous testing:
- [ ] add a local flake
- [ ] add a remote flake
0 commit comments