3 releases
0.1.2 | Jun 19, 2023 |
---|---|
0.1.1 | Jun 9, 2023 |
0.1.0 | Jun 9, 2023 |
#129 in #package-manager
135KB
3K
SLoC
A cargo builder that uses the buildRustCrate
from the nix package manager.
This yields the following benefits:
- Sandbox builds: A malicious dependency in project
A
cannot alter the filesystem or inject source code into libraries that will affect the build of another projectB
. - Shared cache: If project
A
has a dependency on some crate, let's saytokio
, with featuresmacros
andrt
, then this builder will cache each dependency individually. So if projectB
also usestokio
with the same features and version, then thetokio
dependency will not be rebuild. - Reproducible: Given the same version and targets, any project will build exactly the same on different machines.
Install
cargo install cargo-nbuild
⚠️ The nix package manager needs to be installed on your system.
💡 You also need to enable the new nix command in the user specific configuration or system wide configuration.
Usage
From a Rust project run
cargo nbuild
Missing
This builder is still in early days and is missing features
- Choosing target: like with
cargo build --target ...
- Choosing workspace package: builds only work when inside the workspace member, and not when you are at the workspace root. Ie the
cargo build --package ...
equavalent is missing. - Remote builds: nix supports remote builds which are not currently possible
- Custom rust version: it should be possible to change the version of rustc used for the compiles
- ... other
cargo build
options
Dependencies
~11–21MB
~274K SLoC