File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -951,17 +951,20 @@ func (d *Devbox) ensurePackagesAreInstalledAndComputeEnv(
951
951
) (map [string ]string , error ) {
952
952
defer debug .FunctionTimer ().End ()
953
953
954
+ // We need to check the lockfile status prior to ensurePackagesAreInstalled
955
+ // since it will update the lockfile to be up-to-date.
956
+ upToDate , err := d .lockfile .IsUpToDateAndInstalled ()
957
+ if err != nil {
958
+ return nil , err
959
+ }
960
+
954
961
// When ensurePackagesAreInstalled is called with ensure=true, it always
955
962
// returns early if the lockfile is up to date. So we don't need to check here
956
963
if err := d .ensurePackagesAreInstalled (ctx , ensure ); err != nil {
957
964
return nil , err
958
965
}
959
966
960
- // Since ensurePackagesAreInstalled calls computeNixEnv when not up do date,
961
- // it's ok to use usePrintDevEnvCache=true here always. This does end up
962
- // doing some non-nix work twice if lockfile is not up to date.
963
- // TODO: Improve this to avoid extra work.
964
- return d .computeNixEnv (ctx , true )
967
+ return d .computeNixEnv (ctx , upToDate /*usePrintDevEnvCache*/ )
965
968
}
966
969
967
970
func (d * Devbox ) nixPrintDevEnvCachePath () string {
You can’t perform that action at this time.
0 commit comments