-
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
Git workspaces #298
base: master
Are you sure you want to change the base?
Git workspaces #298
Conversation
It has a fairly narrow range of libgit2 versions it will accept from the system environment, so instead of manually providing a recent-enough version from nixpkgs-unstable, or downgrading the rust crate until the available version matches, we allow it to build its preferred version.
When copying out workspace member crates from a larger workspace, cargo will not be able to process the separated manifest if it still refers to e.g. the workspace license or workspace dependencies, because it can't find the workspace manifest. We can't help it find the workspace manifest, because crates in a cargo vendor directory aren't discovered recursively, and cargo doesn't resolve symlinks before checking the ancestors to find the workspace manifest.
Heyo @tilpner, I am not sure when I have time to think about this. But I already merged some of your commits on master, so thanks a lot! |
Hi! I really appreciate the work done in this PR! After the changes that have already been merged I still have a desire for an option to get dependencies from workspaces via git in IFD mode. So I've merged the PR branch with the latest crate2nix code, and fixed things up. I think it's in a good state to review: https://github.com/hallettj/crate2nix/tree/git-workspaces That branch depends on #382 which should be merged first. |
This adds support for using workspaces in git dependencies with inherited fields, building upon #166 and #281.
An example project which doesn't build on master, but works with this PR, can be found here.
#166 takes care of exposing workspace members at the top level of a vendoring entry, so that cargo can find it, but it abducts the crate from its workspace without adjusting the manifest.
For example, the sqlx-postgres manifest inherits dependencies and metadata (edition, license) from the workspace manifest. These fields can't be filled in by cargo after copying the member crate out of the workspace, so this PR fills in that information before/while copying it out.
It does add a dependency on cargo's unstable API, which I found preferable to reimplementing the manifest inheritance on top of
cargo_metadata
, but I'd understand if it's an unacceptable choice for crate2nix. cargo (in the most recent version, which might not be required) also expects a very recent rustc.The libgit2-sys dependencies are currently duplicated, due to lack of a central place to put them. If tools.nix could import default.nix, this wouldn't be a problem, but that seems to have been avoided so far, and would probably cause changes to the public interface.
If the commit message convention is out of place, or the drive-by "improvements" (don't shadow nix, use stable CLI) don't fit into this PR, we can change/drop them.