nocargo
nocargo copied to clipboard
Git dependencies with workspaces are not supported
If you try to build a project that uses dependencies from a git repository, and that git repository contains multiple crates using a Cargo workspace, you
You can reproduce this error using a repository I made for this purpose that just contains a workspace with two dummy libraries.
cargo new --bin nocargo-workspace-issue
echo 'lib1 = { git = "https://git.sr.ht/~jakewaksbaum/nocargo-workspace-issue-example" }' >> Cargo.toml
echo 'lib2 = { git = "https://git.sr.ht/~jakewaksbaum/nocargo-workspace-issue-example" }' >> Cargo.toml
nix run github:oxalica/nocargo init
git add .
nix build
This fails with an error:
error: 'mkPkgInfoFromCargoToml' at /nix/store/ppzn93hsjjq8nnif26s7w2a2zj8m8wa6-source/lib/pkg-info.nix:163:28 called without required argument 'package'
at /nix/store/ppzn93hsjjq8nnif26s7w2a2zj8m8wa6-source/lib/support.nix:118:9:
117| gitSrcInfos = mapAttrs (url: src:
118| mkPkgInfoFromCargoToml (fromTOML (readFile (src + "/Cargo.toml")) // lockVersionSet) src
| ^
119| ) gitSrcs;
(use '--show-trace' to show detailed location information)
I think this issue could be fixed by adapting the logic used for reading the Cargo.toml
of the project we're building, since that handles workspaces fine.
Same thing here, any way you could give us some guidance into how to commit a fix for this? @oxalica I'd be glad to help, but need some "onboarding" ig :P