Skip to content
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

Add additionalCrateHashes to generatedCargoNix #283

Merged

Conversation

Ericson2314
Copy link
Collaborator

@Ericson2314 Ericson2314 commented Mar 14, 2023

This makes it easy to use a crate-hashes.json that is outside any source tree. By default it is the crate-hashes.json at the root of the source tree. Additional such files next to any Cargo.lock will also be used unconditionally.

Behind the scenes, the vendor support was already reworked to separate more opinionated gathering lockfiles and crate-hashes.json from the basic crate2nix-agnostic work of creating the vendor dir. This cleans up the code, and makes supporting the new feature easier too.

Finally, let me note one thing as future work. In NixOS/nixpkgs#217084 I learned from @winterqt that Nixpkgs now has a importCargoLock. It would be very nice to drop the vendoring logic from tools.nix and use that instead, now that the crate2nix-specific bits have been pulled out as described above.

Ericson2314 and others added 7 commits March 14, 2023 14:39
This makes it easy to use a `crate-hashes.json` that is outside any
source tree.
Should be cleaned up before merging.
Split out hashes from vendorSupport and make them their own function
Hashes are now computed separately from vendorSupport
extraHashes gets replaced with extendedHashes.
We now always write back the extended hashes to the vendor dir. To
account for the `crate-hashes.json` that might already be there, we make
its contents the default value for `additionalCrateHashes.
@Ericson2314 Ericson2314 marked this pull request as ready for review March 14, 2023 18:36
@Ericson2314 Ericson2314 changed the title Add additionalCrateHashes to vendor support Add additionalCrateHashes to generatedCargoNix Mar 14, 2023
@Ericson2314 Ericson2314 merged commit 6b2f8d8 into nix-community:master Mar 14, 2023
@Ericson2314 Ericson2314 deleted the vendor-external-crate-hashes branch March 14, 2023 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants