fix(update): skip Nix calls when --no-install is set (#2585)#2913
Open
mikeland73 wants to merge 2 commits into
Open
fix(update): skip Nix calls when --no-install is set (#2585)#2913mikeland73 wants to merge 2 commits into
mikeland73 wants to merge 2 commits into
Conversation
`devbox update --no-install` still shelled out to Nix after refreshing the lockfile: it unconditionally ran `nix flake update` (via FlakeUpdate) and `nix path-info` (via FixMissingStorePaths). This defeats the purpose of --no-install and breaks the command in environments where Nix isn't fully set up (e.g. CI/Renovate), where those calls print "Running nix flake update" or crash with "cannot determine user's home directory". Guard both Nix-invoking steps behind `!opts.NoInstall` so the flag only updates the lockfile. Add a regression testscript asserting that `devbox update --no-install` does not run `nix flake update`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gtqrm1XgX3ZvcjHCJjuBgt
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes devbox update --no-install still invoking Nix after refreshing the lockfile by skipping the trailing nix flake update and FixMissingStorePaths steps when --no-install is set, matching the documented behavior and preventing failures in environments where Nix isn’t fully configured (e.g. CI/Renovate).
Changes:
- Guard
nix.FlakeUpdate(...)andDevbox.FixMissingStorePaths(...)behind!opts.NoInstallinDevbox.Update. - Add a testscript regression assertion that
devbox update --no-installdoes not emitnix flake update.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/devbox/update.go | Skips post-update Nix calls when --no-install is set. |
| testscripts/update/update.test.txt | Adds regression coverage to ensure nix flake update is not invoked/logged under --no-install. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+88
to
+92
| // With --no-install we only refresh the lockfile, so skip every step that | ||
| // shells out to Nix. This keeps `devbox update --no-install` usable in | ||
| // environments where Nix isn't fully set up (e.g. CI/Renovate), where | ||
| // running "nix flake update" or "nix path-info" would otherwise fail. | ||
| // See jetify-com/devbox#2585. |
Comment on lines
+7
to
+9
| # `devbox update --no-install` only refreshes the lockfile and must not shell | ||
| # out to Nix (e.g. "nix flake update"). Regression test for #2585. | ||
| exec devbox update --no-install |
Reword the code and testscript comments to describe exactly the two post-update Nix steps that --no-install skips (nix flake update and nix path-info), rather than implying the whole update flow avoids Nix. Flake-ref resolution earlier in the flow may still invoke Nix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gtqrm1XgX3ZvcjHCJjuBgt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2585.
devbox update --no-installis documented as "update lockfile but don't install anything", but it still shelled out to Nix after refreshing the lockfile. InDevbox.Updatetwo steps ran unconditionally, regardless of--no-install:nix.FlakeUpdate(...)→ runsnix flake update(this is theInfo: Running "nix flake update"line the reporter sees).d.FixMissingStorePaths(ctx)→ runsnix path-info ....ensureStateIsUpToDate(noInstall)already correctly avoids Nix (it skipsinstallPackagesandrecomputeState), so these two trailing calls were the only thing still invoking Nix. Besides defeating the purpose of the flag, they break the command in environments where Nix isn't fully set up (e.g. CI/Renovate), where the reporter hit a hard crash:Changes
internal/devbox/update.go: guard thenix.FlakeUpdateandFixMissingStorePathscalls behind!opts.NoInstallso--no-installonly refreshes the lockfile and never shells out to Nix.plugin.Update()(which just clears a cache and does not touch Nix) still runs.testscripts/update/update.test.txt: add a regression assertion thatdevbox update --no-installdoes not printnix flake update.How was it tested?
go build ./internal/devbox/andgo vet ./internal/devbox/— clean.gofmt -l internal/devbox/update.go— no diffs.exec devbox update --no-installfollowed by! stderr 'nix flake update') to the existingupdatetestscript, which runs against real Nix in CI.Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.
cc @abeltavares (issue reporter)
🤖 Generated with Claude Code
Generated by Claude Code