The rust plugin is useful for building Rust-based parts using the Cargo package manager to drive the build. This plugin uses the common plugin keywords as well as those for sources. For more information, see Snapcraft parts metadata.
Additional features and syntax are dependent on which base is being used, as outlined below:
rust-features (list of strings)
Features used to build optional dependencies
rust-path (list of strings)
Defaults to the current working directory. Can be set to the relative path for the crate to build when using workspaces. Only one item is currently supported.
Requires Snapcraft version 7.0+.
base: core20
rust-features (list of strings)
Features used to build optional dependencies
rust-path (list of strings)
Defaults to the current working directory. Can be set to the relative path for the crate to build when using workspaces. Only one item is currently supported.
Requires Snapcraft version 4.0+.
base: core18 | core
rust-channel (string)
Used to select which rust channel (stable, beta, nightly)
rust-features (list of strings)
Features used to build optional dependencies
rust-revision (string)
Used to select which rust version
If a rust-toolchain file is detected, the toolchain it specifies will be used by default. However, if rust-channel or rust-revision are set, the rust-toolchain file will be overridden.
If neither a rust-toolchain exists nor rust-channel or rust-revision are set, the latest stable toolchain will be used.
I’m not sure how to set default_toolchain, as rustup will look in ${RUSTUP_HOME}/settings.toml and /etc/rustup/settings.toml, but that’s happening within the build VM/container. I don’t see how I can add a settings.toml anywhere in my Rust codebase such that rustup will see it when building the snap.