jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.82k stars 207 forks source link

shellgen: delete flake.lock if flake.nix changes #2388

Closed gcurtis closed 3 weeks ago

gcurtis commented 3 weeks ago

Fix a bug where .devbox/gen/flake gets locked on old versions of .devbox/gen/flake/glibc-patch by deleting the flake.lock file.

We only delete the lock file when the generated flake changes so that Nix isn't forced to re-evaluate it every time.

The repro steps are:

  1. Add a package that gets auto-patched (devbox add python@3.11.9).
  2. .devbox/gen/flake gets locked on the patch flake.
  3. Change the patched package (devbox add python@3.11.10).
  4. The new patch flake isn't used because of .devbox/gen/flake/flake.lock. Instead, the old version is used (from the Nix store).

Fixes #2316. Fixes #2370.