about summary refs log tree commit diff
path: root/pkgs/build-support/rust
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-07-02 11:22:47 -0400
committerShea Levy <shea@shealevy.com>2018-07-02 11:22:47 -0400
commit98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c (patch)
tree694aa4ef0298ac7b0afe110d506bada44c031127 /pkgs/build-support/rust
parentcb692ff8135ff321263ce01a8d2576f967786e70 (diff)
downloadnixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.tar
nixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.tar.gz
nixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.tar.bz2
nixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.tar.lz
nixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.tar.xz
nixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.tar.zst
nixlib-98ddba156c9cde7bd8292e9c1ad74dc723b7ee7c.zip
buildRustCrate: Add some commentary about target_os.
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r--pkgs/build-support/rust/build-rust-crate.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate.nix b/pkgs/build-support/rust/build-rust-crate.nix
index 5e89c1411fda..be76c283babc 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"