From 4403d44763a1f8fb2bae6fd844406a47b99abf3b Mon Sep 17 00:00:00 2001 From: Adelbert Chang Date: Wed, 31 Jul 2019 05:19:01 -0700 Subject: [PATCH] buildRustPackage: fix cargo flag for release/debug build (#61521) Previous behavior did not actually allow for "debug" build as it would try to pass --debug to cargo, which is not a valid flag. --- pkgs/build-support/rust/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index 306b70419ed1..6afe93c7e4c1 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -46,7 +46,6 @@ let ccForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; cxxForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; releaseDir = "target/${stdenv.hostPlatform.config}/${buildType}"; - in stdenv.mkDerivation (args // { inherit cargoDeps; @@ -104,7 +103,7 @@ in stdenv.mkDerivation (args // { "CC_${stdenv.hostPlatform.config}"="${ccForHost}" \ "CXX_${stdenv.hostPlatform.config}"="${cxxForHost}" \ cargo build \ - --${buildType} \ + ${stdenv.lib.optionalString (buildType == "release") "--release"} \ --target ${stdenv.hostPlatform.config} \ --frozen ${concatStringsSep " " cargoBuildFlags} )