diff --git a/pkgs/build-support/rust/build-rust-crate.nix b/pkgs/build-support/rust/build-rust-crate.nix index 5e89c1411fd..be76c283bab 100644 --- a/pkgs/build-support/rust/build-rust-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate.nix @@ -15,6 +15,12 @@ let makeDeps = dependencies: " --extern ${extern}=${dep.out}/lib/lib${extern}-${dep.metadata}${buildPlatform.extensions.sharedLibrary}") ) dependencies); + # This doesn't appear to be officially documented anywhere yet. + # See https://github.com/rust-lang-nursery/rust-forge/issues/101. + target_os = if buildPlatform.isDarwin + then "macos" + else buildPlatform.parsed.kernel.name; + echo_build_heading = colors: '' echo_build_heading() { start="" @@ -101,7 +107,7 @@ let makeDeps = dependencies: export CARGO_PKG_AUTHORS="${authors}" export CARGO_CFG_TARGET_ARCH=${buildPlatform.parsed.cpu.name} - export CARGO_CFG_TARGET_OS=${if buildPlatform.isDarwin then "macos" else buildPlatform.parsed.kernel.name} + export CARGO_CFG_TARGET_OS=${target_os} export CARGO_CFG_TARGET_FAMILY="unix" export CARGO_CFG_UNIX=1 export CARGO_CFG_TARGET_ENV="gnu"