diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2018-11-21 12:38:49 +0000 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2018-11-21 12:44:58 +0000 |
commit | 952f4fda864b61314f21a07766b74c344d124843 (patch) | |
tree | 2b3d7d2951187e6e7caa366818aa4e6ed710dda0 /pkgs/build-support/rust | |
parent | fda41e851bda13a9cbba77e374aea3d0d29b1a38 (diff) | |
download | nixpkgs-952f4fda864b61314f21a07766b74c344d124843.tar nixpkgs-952f4fda864b61314f21a07766b74c344d124843.tar.gz nixpkgs-952f4fda864b61314f21a07766b74c344d124843.tar.bz2 nixpkgs-952f4fda864b61314f21a07766b74c344d124843.tar.lz nixpkgs-952f4fda864b61314f21a07766b74c344d124843.tar.xz nixpkgs-952f4fda864b61314f21a07766b74c344d124843.tar.zst nixpkgs-952f4fda864b61314f21a07766b74c344d124843.zip |
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.
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r-- | pkgs/build-support/rust/default.nix | 10 | ||||
-rw-r--r-- | pkgs/build-support/rust/fetchcargo.nix | 4 | ||||
-rw-r--r-- | pkgs/build-support/rust/make-rust-platform.nix | 18 |
3 files changed, 23 insertions, 9 deletions
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index 5fdcf520440..43aecdef5f2 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -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; diff --git a/pkgs/build-support/rust/fetchcargo.nix b/pkgs/build-support/rust/fetchcargo.nix index 9e77f8817b2..c23fa66ef9f 100644 --- a/pkgs/build-support/rust/fetchcargo.nix +++ b/pkgs/build-support/rust/fetchcargo.nix @@ -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"; diff --git a/pkgs/build-support/rust/make-rust-platform.nix b/pkgs/build-support/rust/make-rust-platform.nix new file mode 100644 index 00000000000..afbc56865ff --- /dev/null +++ b/pkgs/build-support/rust/make-rust-platform.nix @@ -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; + }; +} |