@goodiebag/nx-rust
v3.1.0
Published
<div align="center"> <img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="80" alt="Nx Logo"> <h1>@goodiebag/nx-rust</h1> <p><em>Part of the <a href="https://github.com/deepbrainspace/goodiebag">GoodieBag</a> collecti
Readme
A modern Nx plugin that adds comprehensive support for Cargo and Rust in your Nx workspace.
Built upon the excellent foundation of @monodon/rust by the Monodon team.
This fork enhances the original plugin with additional features, improved reliability, and modern Nx compatibility while maintaining the core philosophy of seamless Rust integration.
Compatibility Chart
| @goodiebag/nx-rust | nx | | ------------------ | -------- | | >=3.0.0 | >=19.0.0 |
Getting Started
Prerequisites
The following tools need to be installed on your system to take full advantage
of @goodiebag/nx-rust
- Node (LTS)
- Rust / Cargo via https://rustup.rs
Installation
Install the plugin in your existing Nx workspace:
# Using pnpm (recommended)
pnpm add -D @goodiebag/nx-rust
# Using npm
npm install -D @goodiebag/nx-rust
# Using yarn
yarn add -D @goodiebag/nx-rustInitialization
After installing, you can run any of the project generators (binary, library) to have @goodiebag/nx-rust set up Cargo in your workspace.
Generators
Use Nx Console to see the full list of options for each generator.
@goodiebag/nx-rust:binary
Creates a Rust binary application to be run independently.
Create a new binary:
nx generate @goodiebag/nx-rust:binary my-rust-app
@goodiebag/nx-rust:library
Creates a Rust library that can be used in binaries, or compiled to be used for napi.
Create a new library:
nx generate @goodiebag/nx-rust:library my-rust-lib
Create a new library with napi:
nx generate @goodiebag/nx-rust:library my-rust-node-lib --napi
Napi
Generating a library with the --napi flag will set up the project to be built
with it.
Executors
All the executors support these additional properties:
- toolchain: (e.g.
--toolchain='stable' | 'beta' | 'nightly');- Uses
stableby default
- Uses
- target (e.g.
--target=aarch64-apple-darwin); - profile (e.g.
--profile=dev) - release
- target-dir
- features (e.g.
--features=bmp) - all-features
- args
- Arguments forwarding to the executor.
@goodiebag/nx-rust:build
Runs cargo to build the project
Not supported with napi
@goodiebag/nx-rust:lint
Runs cargo clippy to lint the project
@goodiebag/nx-rust:napi
Runs the napi cli to build the project
@goodiebag/nx-rust:run
Runs cargo run for the project
Not supported with napi
@goodiebag/nx-rust:test
Runs cargo test for the project
