···237237 --target /nix/store/asdfasdfsadf-thumb-crazy.json # contains {"foo":"","bar":""}
238238 ```
239239240240-Finally, as an ad-hoc escape hatch, a computed target (string or JSON file
241241-path) can be passed directly to `buildRustPackage`:
242242-243243-```nix
244244-pkgs.rustPlatform.buildRustPackage {
245245- /* ... */
246246- target = "x86_64-fortanix-unknown-sgx";
247247-}
248248-```
249249-250250-This is useful to avoid rebuilding Rust tools, since they are actually target
251251-agnostic and don't need to be rebuilt. But in the future, we should always
252252-build the Rust tools and standard library crates separately so there is no
253253-reason not to take the `stdenv.hostPlatform.rustc`-modifying approach, and the
254254-ad-hoc escape hatch to `buildRustPackage` can be removed.
255255-256240Note that currently custom targets aren't compiled with `std`, so `cargo test`
257241will fail. This can be ignored by adding `doCheck = false;` to your derivation.
258242