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 # Hooks
55 inherit
56 (callPackages ../../../build-support/rust/hooks {
57 inherit
58 stdenv
59 cargo
60 rustc
61 callPackage
62 ;
63 })
64 cargoBuildHook
65 cargoCheckHook
66 cargoInstallHook
67 cargoNextestHook
68 cargoSetupHook
69 maturinBuildHook
70 bindgenHook
71 ;
72 };
73})
74// lib.optionalAttrs config.allowAliases {
75 rust = {
76 rustc = lib.warn "rustPlatform.rust.rustc is deprecated. Use rustc instead." rustc;
77 cargo = lib.warn "rustPlatform.rust.cargo is deprecated. Use cargo instead." cargo;
78 };
79
80 # Added in 25.05.
81 fetchCargoTarball = throw "`rustPlatform.fetchCargoTarball` has been removed in 25.05, use `rustPlatform.fetchCargoVendor` instead";
82}