1{
2 lib,
3 buildPackages,
4 callPackages,
5 cargo-auditable,
6 config,
7 stdenv,
8 runCommand,
9 generateSplicesForMkScope,
10 makeScopeWithSplicing',
11}@prev:
12
13{
14 rustc,
15 cargo,
16 cargo-auditable ? prev.cargo-auditable,
17 stdenv ? prev.stdenv,
18 ...
19}:
20
21(makeScopeWithSplicing' {
22 otherSplices = generateSplicesForMkScope "rustPlatform";
23 f =
24 self:
25 let
26 inherit (self) callPackage;
27 in
28 {
29 fetchCargoVendor = buildPackages.callPackage ../../../build-support/rust/fetch-cargo-vendor.nix {
30 inherit cargo;
31 };
32
33 buildRustPackage = callPackage ../../../build-support/rust/build-rust-package {
34 inherit
35 stdenv
36 rustc
37 cargo
38 cargo-auditable
39 ;
40 };
41
42 importCargoLock = buildPackages.callPackage ../../../build-support/rust/import-cargo-lock.nix {
43 inherit cargo;
44 };
45
46 rustcSrc = callPackage ./rust-src.nix {
47 inherit runCommand rustc;
48 };
49
50 rustLibSrc = callPackage ./rust-lib-src.nix {
51 inherit runCommand rustc;
52 };
53
54 # Useful when rebuilding std
55 # e.g. when building wasm with wasm-pack
56 rustVendorSrc = callPackage ./rust-vendor-src.nix {
57 inherit runCommand rustc;
58 };
59
60 # Hooks
61 inherit
62 (callPackages ../../../build-support/rust/hooks {
63 inherit
64 stdenv
65 ;
66 })
67 cargoBuildHook
68 cargoCheckHook
69 cargoInstallHook
70 cargoNextestHook
71 cargoSetupHook
72 maturinBuildHook
73 bindgenHook
74 ;
75 };
76})
77// lib.optionalAttrs config.allowAliases {
78 rust = {
79 rustc = lib.warn "rustPlatform.rust.rustc is deprecated. Use rustc instead." rustc;
80 cargo = lib.warn "rustPlatform.rust.cargo is deprecated. Use cargo instead." cargo;
81 };
82
83 # Added in 25.05.
84 fetchCargoTarball = throw "`rustPlatform.fetchCargoTarball` has been removed in 25.05, use `rustPlatform.fetchCargoVendor` instead";
85}