From 54b4b470c3a7149a7c459d92859a51c2e7a04cf7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 1 Oct 2020 17:51:46 -0400 Subject: [PATCH] makeRustPlatform: Put back in it's own file. We expose it on the top level, but I don't think it makes sense to pull it from a specific version of the rust tools when it is in fact version agnostic. This reverts a tiny portion of 912dca193aee9da77a4d429285db53729d81aa3d. --- pkgs/development/compilers/rust/1_44.nix | 1 + pkgs/development/compilers/rust/1_45.nix | 1 + pkgs/development/compilers/rust/default.nix | 19 +---------------- .../compilers/rust/make-rust-platform.nix | 21 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 ++- 5 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 pkgs/development/compilers/rust/make-rust-platform.nix diff --git a/pkgs/development/compilers/rust/1_44.nix b/pkgs/development/compilers/rust/1_44.nix index 9fc268d152b1..17b93cf88ebb 100644 --- a/pkgs/development/compilers/rust/1_44.nix +++ b/pkgs/development/compilers/rust/1_44.nix @@ -13,6 +13,7 @@ , CoreFoundation, Security , llvmPackages_5 , pkgsBuildTarget, pkgsBuildBuild +, makeRustPlatform } @ args: import ./default.nix { diff --git a/pkgs/development/compilers/rust/1_45.nix b/pkgs/development/compilers/rust/1_45.nix index 1a634d3f51ed..05db4520f652 100644 --- a/pkgs/development/compilers/rust/1_45.nix +++ b/pkgs/development/compilers/rust/1_45.nix @@ -13,6 +13,7 @@ , CoreFoundation, Security , llvmPackages_5 , pkgsBuildTarget, pkgsBuildBuild +, makeRustPlatform } @ args: import ./default.nix { diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index d08b63dd643f..c4aef566f8b2 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -12,6 +12,7 @@ , CoreFoundation, Security , llvmPackages_5 , pkgsBuildTarget, pkgsBuildBuild +, makeRustPlatform }: rec { toRustTarget = platform: with platform.parsed; let cpu_ = { @@ -22,24 +23,6 @@ in platform.rustc.config or "${cpu_}-${vendor.name}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}"; - makeRustPlatform = { rustc, cargo, ... }: rec { - rust = { - inherit rustc cargo; - }; - - fetchCargoTarball = buildPackages.callPackage ../../../build-support/rust/fetchCargoTarball.nix { - inherit cargo; - }; - - buildRustPackage = callPackage ../../../build-support/rust { - inherit rustc cargo fetchCargoTarball; - }; - - rustcSrc = callPackage ./rust-src.nix { - inherit rustc; - }; - }; - # This just contains tools for now. But it would conceivably contain # libraries too, say if we picked some default/recommended versions from # `cratesIO` to build by Hydra and/or try to prefer/bias in Cargo.lock for diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix new file mode 100644 index 000000000000..6a827cff9a15 --- /dev/null +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -0,0 +1,21 @@ +{ buildPackages, callPackage }: + +{ rustc, cargo, ... }: + +rec { + rust = { + inherit rustc cargo; + }; + + fetchCargoTarball = buildPackages.callPackage ../../../build-support/rust/fetchCargoTarball.nix { + inherit cargo; + }; + + buildRustPackage = callPackage ../../../build-support/rust { + inherit rustc cargo fetchCargoTarball; + }; + + rustcSrc = callPackage ./rust-src.nix { + inherit rustc; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11b24dfc3f77..fd38e0126d2c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9659,7 +9659,8 @@ in rustPackages = rustPackages_1_45; inherit (rustPackages) cargo clippy rustc rustPlatform; - inherit (rust) makeRustPlatform; + + makeRustPlatform = callPackage ../development/compilers/rust/make-rust-platform.nix {}; buildRustCrate = callPackage ../build-support/rust/build-rust-crate { }; buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };