Merge pull request #50878 from Mic92/rust-cleanup
makeRustPlatform: refactor to make it easier to understand
This commit is contained in:
commit
5abdde2a1c
@ -1,9 +1,5 @@
|
||||
{ stdenv, cacert, git, rust, cargo-vendor, python3 }:
|
||||
let
|
||||
fetchcargo = import ./fetchcargo.nix {
|
||||
inherit stdenv cacert git rust cargo-vendor python3;
|
||||
};
|
||||
in
|
||||
{ stdenv, cacert, git, cargo, rustc, cargo-vendor, fetchcargo, python3 }:
|
||||
|
||||
{ name, cargoSha256 ? "unset"
|
||||
, src ? null
|
||||
, srcs ? null
|
||||
@ -45,7 +41,7 @@ in stdenv.mkDerivation (args // {
|
||||
|
||||
patchRegistryDeps = ./patch-registry-deps;
|
||||
|
||||
buildInputs = [ cacert git rust.cargo rust.rustc ] ++ buildInputs;
|
||||
buildInputs = [ cacert git cargo rustc ] ++ buildInputs;
|
||||
|
||||
patches = cargoPatches ++ patches;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ stdenv, cacert, git, rust, cargo-vendor, python3 }:
|
||||
{ stdenv, cacert, git, cargo, cargo-vendor, python3 }:
|
||||
let cargo-vendor-normalise = stdenv.mkDerivation {
|
||||
name = "cargo-vendor-normalise";
|
||||
src = ./cargo-vendor-normalise.py;
|
||||
@ -20,7 +20,7 @@ in
|
||||
{ name ? "cargo-deps", src, srcs, patches, sourceRoot, sha256, cargoUpdateHook ? "" }:
|
||||
stdenv.mkDerivation {
|
||||
name = "${name}-vendor";
|
||||
nativeBuildInputs = [ cacert cargo-vendor git cargo-vendor-normalise rust.cargo ];
|
||||
nativeBuildInputs = [ cacert cargo-vendor git cargo-vendor-normalise cargo ];
|
||||
inherit src srcs patches sourceRoot;
|
||||
|
||||
phases = "unpackPhase patchPhase installPhase";
|
||||
|
18
pkgs/build-support/rust/make-rust-platform.nix
Normal file
18
pkgs/build-support/rust/make-rust-platform.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ callPackage }:
|
||||
{ rustc, cargo, ... }: {
|
||||
rust = {
|
||||
inherit rustc cargo;
|
||||
};
|
||||
|
||||
buildRustPackage = callPackage ./default.nix {
|
||||
inherit rustc cargo;
|
||||
|
||||
fetchcargo = callPackage ./fetchcargo.nix {
|
||||
inherit cargo;
|
||||
};
|
||||
};
|
||||
|
||||
rustcSrc = callPackage ../../development/compilers/rust/rust-src.nix {
|
||||
inherit rustc;
|
||||
};
|
||||
}
|
@ -7386,23 +7386,9 @@ with pkgs;
|
||||
|
||||
defaultCrateOverrides = callPackage ../build-support/rust/default-crate-overrides.nix { };
|
||||
|
||||
makeRustPlatform = callPackage ../build-support/rust/make-rust-platform.nix {};
|
||||
rustPlatform = recurseIntoAttrs (makeRustPlatform rust);
|
||||
|
||||
makeRustPlatform = rust: lib.fix (self:
|
||||
let
|
||||
callPackage = newScope self;
|
||||
in {
|
||||
inherit rust;
|
||||
|
||||
buildRustPackage = callPackage ../build-support/rust {
|
||||
inherit rust;
|
||||
};
|
||||
|
||||
rustcSrc = callPackage ../development/compilers/rust/rust-src.nix {
|
||||
inherit (rust) rustc;
|
||||
};
|
||||
});
|
||||
|
||||
cargo-download = callPackage ../tools/package-management/cargo-download { };
|
||||
cargo-edit = callPackage ../tools/package-management/cargo-edit { };
|
||||
cargo-release = callPackage ../tools/package-management/cargo-release { };
|
||||
|
Loading…
Reference in New Issue
Block a user