-
Notifications
You must be signed in to change notification settings - Fork 93
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
allow to pass outputHashes to crane #266
Conversation
If you agree on the idea I can work on tests/docs for this. |
Currently this is what the api looks like:
|
fa6f2cc
to
b21c96e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this @Mic92! I had assumed that builtins.fetchGit
would work offline since we already specify a git revision, but I suppose Nix wants to use its own hash of the content itself and not the git hash 🤦♂️
Anyway I'm definitely open to including this (modulo adding tests and docs, but I can also help flesh those out as needed)!
Thinking from a broader API perspective it would be cool to allow dropping some kind of crane-git-hashes.json
file next to Cargo.lock
and having it automatically be picked up during vendoring so that consumers don't have to manually plumb through a custom vendorCargoDeps
invocation. Though we can and should do that in a separate PR, we can focus on the lower level API changes fist
ff0f209
to
d5c6bf6
Compare
This makes it possible to evaluate crane in a nixos test without network as well as allow to backup all fetched input derivations properly in a binary cache, whereas fetchGit will fallback to downloading from a repository, which also requires a `git` binary to be present.
d5c6bf6
to
956f4aa
Compare
Yes. Let's keep this simple. Json is probably also something consumers wouldn't want to write by hand. |
A package's `source` attribute in `Cargo.lock` is unique because it corresponds to an exact commit. Using the human-specified URL can result in collisions (e.g. a workspace specifies the same "main" URL but locked to two different commits)
Thanks for addressing the feedback @Mic92, looking good! I added a simple test case, and I also changed the key format of The last bits to take care of before merging is to update the CHANGELOG and add some documentation around the change. Feel free to take a shot at that, but if not I'll come back to it later! |
This makes it possible to evaluate crane in a nixos test without network
as well as allow to backup all fetched input derivations properly in a
binary cache, whereas fetchGit will fallback to downloading from a
repository, which also requires a
git
binary to be present.Motivation
Checklist
docs/API.md
(or general documentation) with changesCHANGELOG.md