rustPlatform and workspaces

Do the rustPlatform tools, buildRustCrate or buildRustPackages work with cargo workspaces? I’m trying to set up a monorepo that has several projects in workspaces. Some are libraries, some are executables. I only want to install one executable in my derivation.

In short, I want to do this:

rustPlatform.buildRustCrate {
  buildPhase = ''cargo build --release -p project_1"
}

Are there options to buildRustCrate or buildRustPackages that let me use buildPhase or specify a single project in a workspace?

Specifying a source that is just that one project (src = "/home/savanni/my-monorepo/project_1") means that none of the project_1 dependencies, which are also stored in the monorepo, will be part of the build process.

1 Like