makeRustPlatform: refactor to make it easier to understand

It is now clearer what is supposed to be in the rust attribute set
without having studied type theory. The amount of code is identically.
This commit is contained in:
Jörg Thalheim 2018-11-21 12:38:49 +00:00
parent fda41e851b
commit 952f4fda86
No known key found for this signature in database
GPG Key ID: CA4106B8D7CC79FA
4 changed files with 24 additions and 24 deletions

View File

@ -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;

View File

@ -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";

View 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;
};
}

View File

@ -7384,23 +7384,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 { };