-
Notifications
You must be signed in to change notification settings - Fork 86
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
missing field unused
for key patch
#308
Comments
Cargo stashes unused patches into a special section of the Cargo.lock file: ``` [[patch.unused]] name = "uuid" version = "1.4.1" source = "git+https://github.com/uuid-rs/uuid#50f70278de02c106650b8d6deb325dd59b5f2a24" ``` ... a section that we, currently, don't read. Ignoring that section causes the build to fail because even if the patch is unused, when the source is unavailable, Cargo tries to fetch it (which, understandably, is not possible inside the sandbox). This commit extends our logic so that we download both the "used" and "unused" dependencies. Closes #308.
Curiously, there's one-and-a-half worth of bugs here! tl;dr I've just prepared a fix - after it's merged, you'll have to update your Nixpkgs to a newer version (at least 23, i.e. current First, when Naersk builds a derivation, it converts [patch]
[[unused]]
name = "package"
version = "0.1.0"
source = "..." ... which Cargo (rightfully) doesn't understand anymore. This bug has been fixed recently, but the fix only works when Naersk is launched on Nixpkgs 23+ (because older versions of Nixpkgs had a buggy serializer as well) - so, in principle, if you switched to a newer Nixpkgs (e.g. But, as it turns out, there's second thing at play here - because Naersk doesn't provide sources for ignored dependencies, trying to actually compile such project will fail, saying:
... as Cargo will try to download the "missing" dependency on its own, while being locked in Nix sandbox, which fails. This is a bug on Naersk's side, for which I've just prepared a fix. |
Cargo stashes unused patches into a special section of the Cargo.lock file: ``` [[patch.unused]] name = "uuid" version = "1.4.1" source = "git+https://github.com/uuid-rs/uuid#50f70278de02c106650b8d6deb325dd59b5f2a24" ``` ... a section that we, currently, don't read. Ignoring that section causes the build to fail because even if the patch is unused, when the source is unavailable, Cargo tries to fetch it (which, understandably, is not possible inside the sandbox). This commit extends our logic so that we download both the "used" and "unused" dependencies. Closes #308.
Cargo stashes unused patches into a special section of the Cargo.lock file: ``` [[patch.unused]] name = "uuid" version = "1.4.1" source = "git+https://github.com/uuid-rs/uuid#50f70278de02c106650b8d6deb325dd59b5f2a24" ``` ... a section that we, currently, don't read. Ignoring that section causes the build to fail because even if the patch is unused, when the source is unavailable, Cargo tries to fetch it (which, understandably, is not possible inside the sandbox). This commit extends our logic so that we download both the "used" and "unused" dependencies. Closes #308.
I am getting the above error when building a lockfile with entries like:
I can run this same lockfile with cargo outside of Nix and it compiles fine. I'm having trouble understanding what specifically is making it break when trying to build it with
naersk
.The text was updated successfully, but these errors were encountered: