Skip to content

[lockfile] When updating store-paths, we should update all fields #1530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2023

Conversation

savil
Copy link
Collaborator

@savil savil commented Oct 4, 2023

Summary

When we update the store-paths in the lockfile, we should also update the other fields, including "resolved" for the nixpkgs commit hash, and the modified-time.

This way the exact same derivation is used whether installing the binary directly via store-path, or via relying on the derivation in the package's "resolved" field. This ensures parity for the following scenarios:

  1. A team has a devbox project. Some team members are using nix >= 2.17, while others are using older nix.
  2. The store-path binary is no longer in the nix binary cache, and the package is installed via the older way. This should alleviate @Lagoja's concern that there may be a discrepancy between the store-path and the derivation source in "resolved" field of the package.

How was it tested?

Did devbox update and saw that go@latest had new store-paths, and the "resolved" field was also updated.

Copy link
Collaborator Author

savil commented Oct 4, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@savil savil force-pushed the savil/update-resolved-with-system-info branch from b91f455 to 63a3de8 Compare October 4, 2023 22:39
@savil savil requested review from gcurtis, mikeland73 and ipince October 4, 2023 22:40
@savil savil marked this pull request as ready for review October 4, 2023 22:40
Copy link
Contributor

@mikeland73 mikeland73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should update the entire lock package. The new resolved package will have a different last_modified date as well (and possibly other keys in the future).

Pretty much the only thing that can't change is the version because if it did, we already replace the entire object in the if existing.Version != resolved.Version { check above.

@savil savil force-pushed the savil/update-resolved-with-system-info branch from 63a15ed to c08fe1e Compare October 5, 2023 00:09
@savil savil changed the title [lockfile] When updating store-paths, we should also update the resolved field [lockfile] When updating store-paths, we should update all fields Oct 5, 2023
@savil savil merged commit c70dcb1 into main Oct 5, 2023
@savil savil deleted the savil/update-resolved-with-system-info branch October 5, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants