-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: simplify git dependency detection by only using cargo lock #167
feat: simplify git dependency detection by only using cargo lock #167
Conversation
9c3b87d
to
ae995d1
Compare
8f5f1e9
to
07d0b56
Compare
I tested this branch to see if it works for fetching the submodules of https://crates.io/crates/tflite/0.9.5. I set That works for those regular crates.io dependencies like this:
And the same attributes also work for git dependencies like this:
I think merging this PR would close #110 and that well-written issue was really helpful to me. Before I found this PR I wanted to open a PR for this tiny change to fetch submodules for git dependencies only: mschwaig@2dd2f1b
|
Unrelated to this PR; but may I ask why and where |
It builds fine with You can take a closer look here if you are interested: https://github.com/mschwaig/tflite-rs-not-building That's the minimal test case I got so far. Maybe I should open an issue for this, but I'm not sure. I have not tried building it without |
07d0b56
to
f411315
Compare
Is there something holding this up? I've been using it fine for over a month now as I need it for direct git dependencies in a work project. |
@@ -47,6 +47,8 @@ it is converted to an attribute set equivalent to `{ root = theArg; }`. | |||
| `version` | The version of the derivation. | | |||
| `src` | Used by `naersk` as source input to the derivation. When `root` is not set, `src` is also used to discover the `Cargo.toml` and `Cargo.lock`. | | |||
| `root` | Used by `naersk` to read the `Cargo.toml` and `Cargo.lock` files. May be different from `src`. When `src` is not set, `root` is (indirectly) used as `src`. | | |||
| `allRefs` | Whether to fetch all refs while fetching Git dependencies. Useful if the wanted revision isn't in the default branch. | | |||
| `gitSubmodules` | Whether to fetch submodules while fetching Git dependencies. | |
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.
If this maps to builtins.fetchGit
's submodule support, we should note here that this only works for Nix 2.4+.
I am a big fan of this PR, as it allowed me to only link actual dependencies when creating |
Just ran into #152. Switching to the |
Without this the Nix build is currently failing, because the stable naersk has a bug related to using git dependencies in crate overrides, see: nix-community/naersk#152 Fixing to the naersk in this PR fixed things: nix-community/naersk#167 This should be a short-lived changed. I hope to either get my PR for the abomonation library merged which would make the crate override unnecessary. Should it not get merged I'll likely abandon my abomonation fork for some alternative solution.
Without this the Nix build is currently failing, because the stable naersk has a bug related to using git dependencies in crate overrides, see: nix-community/naersk#152 Fixing to the naersk in this PR fixed things: nix-community/naersk#167 This should be a short-lived changed. I hope to either get my PR for the abomonation library merged which would make the crate override unnecessary. Should it not get merged I'll likely abandon my abomonation fork for some alternative solution.
Thanks for this patch, it's working great! I've found only one small issue - something on the way doesn't handle branches with [patch."ssh://...."]
foo = { git = "ssh://...", branch = "foo-123/bar" } ... fails on a Edit: the fix turns out to be pretty simple! In
.... into:
(this sanitizes paths, so that |
@yusdacra thanks for this merge request - would you mind rebasing it? I'd love to merge it after that 🙂 |
Instead of unpacking all crates in a git dep, this only unpacks the crates specified in the cargo lock file.
8616a0d
to
7882e30
Compare
@yusdacra could you tick |
It seems to already be ticked? Also sorry for not replying, I haven't really had time. |
Sorry then, it looks like I've stumbled upon some bug in GitHub's permissions - I'll sort it out 🙂
No worries, I understand; thanks! |
I'm having some github-permission-issues trying to push my changes in here, so I'm going to merge this pull request into a temporary, non-master branch, push my changes there, and then create a separate PR for that updated branch, hope you don't mind. Thank y'all for reviews and see you in the updated PR (I'll post a link here when it's done) 🙂 |
Follow-up: #231 |
This PR also adds
allRefs
andsubmodules
support. Since these features were added tobuiltins.fetchGit
recently, they are not enabled by default.