I need to do some reading up on Nix, because I don't think I understand it. I thought NixOS was an operating system and Nix an operating system-level package manager, so why is it trying to replace Cargo, a package manager for a specific programming language in Rust?
The same reason Bazel builds avoid using Cargo when building Rust software, so I'll describe why Bazel would do this:
- Bazel wants to cache remote resources, like each respective crate's source files.
- Bazel then wants to build each crate in a sandbox, and cache the build artifacts. Because bazel owns this process, instead of Cargo, it can trivially distribute those build artifacts to other developers, or in CI, etc -- instead of everyone having to build everything from scratch.
This is an established practice, and Nix wants to drive the build for the same reasons.
For the same reason debian's APT manages rust dependencies for its packages - an OS-level package manager needs to support all its languages.
Language-specific package managers fall short as they don't (and often can't) consider cross-language dependencies.