1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

rustPlatform.buildRustPackage: merge custom platforms

We should constrain the set of supported platforms to the platforms
supported by the compiler.  Otherwise we run into the unfortunate
situation where setting meta.platforms in a Rust package to
platforms.unix or platforms.linux will reintroduce CPU architectures
unsupported by the compiler.
This commit is contained in:
Alyssa Ross 2024-06-09 16:41:19 +01:00
parent 5ebc220565
commit 2ade30b7af

View file

@ -150,21 +150,24 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
strictDeps = true;
meta = {
# default to Rust's platforms
platforms = rustc.meta.platforms ++ [
# Platforms without host tools from
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
"armv7a-darwin"
"armv5tel-linux" "armv7a-linux" "m68k-linux" "mips-linux"
"mips64-linux" "mipsel-linux" "mips64el-linux" "riscv32-linux"
"armv6l-netbsd" "mipsel-netbsd" "riscv64-netbsd"
"x86_64-redox"
"wasm32-wasi"
];
badPlatforms = [
meta = meta // {
badPlatforms = meta.badPlatforms or [] ++ [
# Rust is currently unable to target the n32 ABI
lib.systems.inspect.patterns.isMips64n32
];
} // meta;
} // lib.optionalAttrs (rustc.meta ? platforms) {
# default to Rust's platforms
platforms = lib.intersectLists
meta.platforms or lib.platforms.all
(rustc.meta.platforms ++ [
# Platforms without host tools from
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
"armv7a-darwin"
"armv5tel-linux" "armv7a-linux" "m68k-linux" "mips-linux"
"mips64-linux" "mipsel-linux" "mips64el-linux" "riscv32-linux"
"armv6l-netbsd" "mipsel-netbsd" "riscv64-netbsd"
"x86_64-redox"
"wasm32-wasi"
]);
};
})