Commit 2ade30b7 authored by Alyssa Ross's avatar Alyssa Ross
Browse files

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.
parent 5ebc2205
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -150,9 +150,16 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg

  strictDeps = true;

  meta = {
  meta = meta // {
    badPlatforms = meta.badPlatforms or [] ++ [
      # Rust is currently unable to target the n32 ABI
      lib.systems.inspect.patterns.isMips64n32
    ];
  } // lib.optionalAttrs (rustc.meta ? platforms) {
    # default to Rust's platforms
    platforms = rustc.meta.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"
@@ -161,10 +168,6 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
        "armv6l-netbsd" "mipsel-netbsd" "riscv64-netbsd"
        "x86_64-redox"
        "wasm32-wasi"
    ];
    badPlatforms = [
      # Rust is currently unable to target the n32 ABI
      lib.systems.inspect.patterns.isMips64n32
    ];
  } // meta;
      ]);
  };
})