The real problem though is that cargo doesn't play nice as part of system where cargo doesn't own everything.
Cargo needs a lot more ways to be interrogated about the artifacts it produces and control over how they are produced.
Cargo needs a lot more ways to be interrogated about the artifacts it produces and control over how they are produced.
The end result is this bypasses npm's downloading and managing of node_modules, does it all in a fully declarative fashion, and then hands control over to npm to build the package. Also, each dependency's source is cached independently by Nix, so if multiple packages use the exact same dependency, it doesn't have to be redownloaded (unlike Rust where the entire dependency tree is vendored separately per package).
To be clear, Cargo downloads the source globally. The compiled output is per-project, however.