about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/rust/default.nix10
-rw-r--r--pkgs/development/compilers/rust/rustc.nix6
-rw-r--r--pkgs/development/libraries/relibc/default.nix3
3 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index 0fbe5b8c0ed8e..fc1af5a3f9449 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -24,7 +24,8 @@
     if platform.isDarwin then "macos"
     else platform.parsed.kernel.name;
 
-  # Target triple. Rust has slightly different naming conventions than we use.
+  # Returns the name of the rust target, even if it is custom. Adjustments are
+  # because rust has slightly different naming conventions than we do.
   toRustTarget = platform: with platform.parsed; let
     cpu_ = platform.rustc.arch or {
       "armv7a" = "armv7";
@@ -34,6 +35,13 @@
   in platform.rustc.config
     or "${cpu_}-${vendor.name}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
 
+  # Returns the name of the rust target if it is standard, or the json file
+  # containing the custom target spec.
+  toRustTargetSpec = platform:
+    if (platform.rustc.arch or {}) ? custom
+    then builtins.toFile (platform.rustc.config + ".json") (builtins.toJSON platform.rustc.arch.custom)
+    else toRustTarget platform;
+
   # This just contains tools for now. But it would conceivably contain
   # libraries too, say if we picked some default/recommended versions from
   # `cratesIO` to build by Hydra and/or try to prefer/bias in Cargo.lock for
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 65d8920c4a4c4..a5a49f8c3c0b2 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -70,9 +70,9 @@ in stdenv.mkDerivation rec {
     "--set=build.cargo=${rustPlatform.rust.cargo}/bin/cargo"
     "--enable-rpath"
     "--enable-vendor"
-    "--build=${rust.toRustTarget stdenv.buildPlatform}"
-    "--host=${rust.toRustTarget stdenv.hostPlatform}"
-    "--target=${rust.toRustTarget stdenv.targetPlatform}"
+    "--build=${rust.toRustTargetSpec stdenv.buildPlatform}"
+    "--host=${rust.toRustTargetSpec stdenv.hostPlatform}"
+    "--target=${rust.toRustTargetSpec stdenv.targetPlatform}"
 
     "${setBuild}.cc=${ccForBuild}"
     "${setHost}.cc=${ccForHost}"
diff --git a/pkgs/development/libraries/relibc/default.nix b/pkgs/development/libraries/relibc/default.nix
index 43e02fc875860..24d434bf7151b 100644
--- a/pkgs/development/libraries/relibc/default.nix
+++ b/pkgs/development/libraries/relibc/default.nix
@@ -63,7 +63,8 @@ redoxRustPlatform.buildRustPackage rec {
     DESTDIR=$out make install
   '';
 
-  TARGET = buildPackages.rust.toRustTarget stdenvNoCC.targetPlatform;
+  # TODO: should be hostPlatform
+  TARGET = buildPackages.rust.toRustTargetSpec stdenvNoCC.targetPlatform;
 
   cargoSha256 = "1fzz7ba3ga57x1cbdrcfrdwwjr70nh4skrpxp4j2gak2c3scj6rz";