From c50a347cb5604fe92173204872d2ebdb694075b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 26 Feb 2021 11:51:31 +0100 Subject: [PATCH] buildRustPackage: use checkType argument The `checkType` argument of buildRustPackage was not used anymore since the refactoring of `buildRustPackage` into hooks. This was an oversight that is fixed by this change. The check type can also be passed directly to cargoCheckHook using the `cargoCheckType` environment variable. --- doc/languages-frameworks/rust.section.md | 7 ++++--- pkgs/build-support/rust/default.nix | 2 ++ pkgs/build-support/rust/hooks/cargo-check-hook.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 94f94aaffe32..1a749d2c8476 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -320,9 +320,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`. diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index bfa6c0d17cd6..ff9ca642daad 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -103,6 +103,8 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u cargoBuildType = buildType; + cargoCheckType = checkType; + patchRegistryDeps = ./patch-registry-deps; nativeBuildInputs = nativeBuildInputs ++ [ diff --git a/pkgs/build-support/rust/hooks/cargo-check-hook.sh b/pkgs/build-support/rust/hooks/cargo-check-hook.sh index 8c5b1a13219a..82e669af3a08 100644 --- a/pkgs/build-support/rust/hooks/cargo-check-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-check-hook.sh @@ -15,7 +15,7 @@ cargoCheckHook() { threads=1 fi - argstr="--${cargoBuildType} --target @rustTargetPlatformSpec@ --frozen"; + argstr="--${cargoCheckType} --target @rustTargetPlatformSpec@ --frozen"; ( set -x