Skip to content

Commit

Permalink
buildRustPackage: use checkType argument
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danieldk committed Feb 26, 2021
1 parent 10f6849 commit c50a347
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions doc/languages-frameworks/rust.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 2 additions & 0 deletions pkgs/build-support/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u

cargoBuildType = buildType;

cargoCheckType = checkType;

patchRegistryDeps = ./patch-registry-deps;

nativeBuildInputs = nativeBuildInputs ++ [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/rust/hooks/cargo-check-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cargoCheckHook() {
threads=1
fi

argstr="--${cargoBuildType} --target @rustTargetPlatformSpec@ --frozen";
argstr="--${cargoCheckType} --target @rustTargetPlatformSpec@ --frozen";

(
set -x
Expand Down

0 comments on commit c50a347

Please sign in to comment.