diff options
Diffstat (limited to 'doc/languages-frameworks/rust.section.md')
-rw-r--r-- | doc/languages-frameworks/rust.section.md | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 7789ef857ee..8121d03e046 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -72,8 +72,8 @@ For `cargoHash` you can use: Per the instructions in the [Cargo Book](https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html) best practices guide, Rust applications should always commit the `Cargo.lock` file in git to ensure a reproducible build. However, a few packages do not, and -Nix depends on this file, so if it missing you can use `cargoPatches` to apply -it in the `patchPhase`. Consider sending a PR upstream with a note to the +Nix depends on this file, so if it is missing you can use `cargoPatches` to +apply it in the `patchPhase`. Consider sending a PR upstream with a note to the maintainer describing why it's important to include in the application. The fetcher will verify that the `Cargo.lock` file is in sync with the `src` @@ -157,7 +157,7 @@ path) can be passed directly to `buildRustPackage`: ```nix pkgs.rustPlatform.buildRustPackage { - (...) + /* ... */ target = "x86_64-fortanix-unknown-sgx"; } ``` @@ -192,6 +192,13 @@ rustPlatform.buildRustPackage { Please note that the code will be compiled twice here: once in `release` mode for the `buildPhase`, and again in `debug` mode for the `checkPhase`. +Test flags, e.g., `--features xxx/yyy`, can be passed to `cargo test` via the +`cargoTestFlags` attribute. + +Another attribute, called `checkFlags`, is used to pass arguments to the test +binary itself, as stated +(here)[https://doc.rust-lang.org/cargo/commands/cargo-test.html]. + #### Tests relying on the structure of the `target/` directory Some tests may rely on the structure of the `target/` directory. Those tests @@ -321,9 +328,10 @@ attributes can also be used: variable `buildAndTestSubdir` can be used to build a crate in a Cargo workspace. Additional maturin flags can be passed through `maturinBuildFlags`. -* `cargoCheckHook`: run tests using Cargo. Additional flags can be - passed to Cargo using `checkFlags` and `checkFlagsArray`. By - default, tests are run in parallel. This can be disabled by setting +* `cargoCheckHook`: run tests using Cargo. The build type for checks + can be set using `cargoCheckType`. Additional flags can be passed to + the tests using `checkFlags` and `checkFlagsArray`. By default, + tests are run in parallel. This can be disabled by setting `dontUseCargoParallelTests`. * `cargoInstallHook`: install binaries and static/shared libraries that were built using `cargoBuildHook`. |