diff options
Diffstat (limited to 'pkgs/build-support/rust/build-rust-package/default.nix')
-rw-r--r-- | pkgs/build-support/rust/build-rust-package/default.nix | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix index 9b2e62fc240..cf2ddbd084b 100644 --- a/pkgs/build-support/rust/build-rust-package/default.nix +++ b/pkgs/build-support/rust/build-rust-package/default.nix @@ -1,7 +1,6 @@ { lib , importCargoLock , fetchCargoTarball -, rust , stdenv , callPackage , cargoBuildHook @@ -62,7 +61,6 @@ assert cargoVendorDir == null && cargoLock == null -> !(args ? cargoSha256 && args.cargoSha256 != null) && !(args ? cargoHash && args.cargoHash != null) -> throw "cargoSha256, cargoHash, cargoVendorDir, or cargoLock must be set"; -assert buildType == "release" || buildType == "debug"; let @@ -79,18 +77,13 @@ let sha256 = args.cargoSha256; } // depsExtraArgs); - target = rust.toRustTargetSpec stdenv.hostPlatform; + target = stdenv.hostPlatform.rust.rustcTargetSpec; targetIsJSON = lib.hasSuffix ".json" target; useSysroot = targetIsJSON && !__internal_dontAddSysroot; - # see https://github.com/rust-lang/cargo/blob/964a16a28e234a3d397b2a7031d4ab4a428b1391/src/cargo/core/compiler/compile_kind.rs#L151-L168 - # the "${}" is needed to transform the path into a /nix/store path before baseNameOf - shortTarget = if targetIsJSON then - (lib.removeSuffix ".json" (builtins.baseNameOf "${target}")) - else target; - sysroot = callPackage ./sysroot { } { - inherit target shortTarget; + inherit target; + shortTarget = stdenv.hostPlatform.rust.cargoShortTarget; RUSTFLAGS = args.RUSTFLAGS or ""; originalCargoToml = src + /Cargo.toml; # profile info is later extracted }; @@ -162,10 +155,15 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg # Platforms without host tools from # https://doc.rust-lang.org/nightly/rustc/platform-support.html "armv7a-darwin" - "armv5tel-linux" "armv7a-linux" "m68k-linux" "riscv32-linux" + "armv5tel-linux" "armv7a-linux" "m68k-linux" "mipsel-linux" + "mips64el-linux" "riscv32-linux" "armv6l-netbsd" "x86_64-redox" "wasm32-wasi" ]; + badPlatforms = [ + # Rust is currently unable to target the n32 ABI + lib.systems.inspect.patterns.isMips64n32 + ]; } // meta; }) |