about summary refs log tree commit diff
path: root/pkgs/development/compilers/rust
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-12 14:17:16 +0000
committerAlyssa Ross <hi@alyssa.is>2023-05-12 15:31:21 +0000
commit5e06b3cb197047072fc25e0eb1a507bbd7bf847e (patch)
tree1468ee6a19c687929931e6b3312b54dd0811bcdd /pkgs/development/compilers/rust
parentb22c35f05bee135148303428e8545aba302b5376 (diff)
downloadnixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.tar
nixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.tar.gz
nixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.tar.bz2
nixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.tar.lz
nixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.tar.xz
nixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.tar.zst
nixlib-5e06b3cb197047072fc25e0eb1a507bbd7bf847e.zip
treewide: don't use rustPlatform.rust
This will be deprecated in the next commit.
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r--pkgs/development/compilers/rust/clippy.nix10
-rw-r--r--pkgs/development/compilers/rust/default.nix8
-rw-r--r--pkgs/development/compilers/rust/rustc.nix8
-rw-r--r--pkgs/development/compilers/rust/rustfmt.nix8
4 files changed, 19 insertions, 15 deletions
diff --git a/pkgs/development/compilers/rust/clippy.nix b/pkgs/development/compilers/rust/clippy.nix
index 018aba1f3568..8459002743bb 100644
--- a/pkgs/development/compilers/rust/clippy.nix
+++ b/pkgs/development/compilers/rust/clippy.nix
@@ -1,8 +1,8 @@
-{ stdenv, lib, rustPlatform, Security, patchelf }:
+{ stdenv, lib, rustPlatform, rustc, Security, patchelf }:
 
 rustPlatform.buildRustPackage {
   pname = "clippy";
-  inherit (rustPlatform.rust.rustc) version src;
+  inherit (rustc) version src;
 
   separateDebugInfo = true;
 
@@ -13,7 +13,7 @@ rustPlatform.buildRustPackage {
   # changes hash of vendor directory otherwise
   dontUpdateAutotoolsGnuConfigScripts = true;
 
-  buildInputs = [ rustPlatform.rust.rustc.llvm ]
+  buildInputs = [ rustc.llvm ]
     ++ lib.optionals stdenv.isDarwin [ Security ];
 
   # fixes: error: the option `Z` is only accepted on the nightly compiler
@@ -31,8 +31,8 @@ rustPlatform.buildRustPackage {
   # [0]: https://github.com/rust-lang/rust/blob/f77f4d55bdf9d8955d3292f709bd9830c2fdeca5/src/bootstrap/builder.rs#L1543
   # [1]: https://github.com/rust-lang/rust/blob/f77f4d55bdf9d8955d3292f709bd9830c2fdeca5/compiler/rustc_codegen_ssa/src/back/linker.rs#L323-L331
   preFixup = lib.optionalString stdenv.isDarwin ''
-    install_name_tool -add_rpath "${rustPlatform.rust.rustc}/lib" "$out/bin/clippy-driver"
-    install_name_tool -add_rpath "${rustPlatform.rust.rustc}/lib" "$out/bin/cargo-clippy"
+    install_name_tool -add_rpath "${rustc}/lib" "$out/bin/clippy-driver"
+    install_name_tool -add_rpath "${rustc}/lib" "$out/bin/cargo-clippy"
   '';
 
   meta = with lib; {
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index 1ef03420ced9..5c0cf10fbc9a 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -68,6 +68,7 @@ in
         patches = rustcPatches;
 
         # Use boot package set to break cycle
+        inherit (bootstrapRustPackages) cargo rustc;
         rustPlatform = bootRustPlatform;
       } // lib.optionalAttrs (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) {
         stdenv = llvmBootstrapForDarwin.stdenv;
@@ -75,7 +76,10 @@ in
         pkgsBuildHost = pkgsBuildBuild // { targetPackages.stdenv = llvmBootstrapForDarwin.stdenv; };
         pkgsBuildTarget = pkgsBuildTarget // { targetPackages.stdenv = llvmBootstrapForDarwin.stdenv; };
       });
-      rustfmt = self.callPackage ./rustfmt.nix { inherit Security; };
+      rustfmt = self.callPackage ./rustfmt.nix {
+        inherit Security;
+        inherit (self.buildRustPackages) rustc;
+      };
       cargo = self.callPackage ./cargo.nix {
         # Use boot package set to break cycle
         rustPlatform = bootRustPlatform;
@@ -83,7 +87,7 @@ in
       };
       cargo-auditable = self.callPackage ./cargo-auditable.nix { };
       cargo-auditable-cargo-wrapper = self.callPackage ./cargo-auditable-cargo-wrapper.nix { };
-      clippy = callPackage ./clippy.nix {
+      clippy = self.callPackage ./clippy.nix {
         # We want to use self, not buildRustPackages, so that
         # buildPackages.clippy uses the cross compiler and supports
         # linting for the target platform.
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index fc43cfe2e265..500b63c69275 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -1,7 +1,7 @@
 { lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, targetPackages
 , llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackages
 , fetchurl, file, python3
-, darwin, cmake, rust, rustPlatform
+, darwin, cargo, cmake, rust, rustc, rustPlatform
 , pkg-config, openssl, xz
 , libiconv
 , which, libffi
@@ -73,8 +73,8 @@ in stdenv.mkDerivation rec {
     cxxForTarget = "${pkgsBuildTarget.targetPackages.stdenv.cc}/bin/${pkgsBuildTarget.targetPackages.stdenv.cc.targetPrefix}c++";
   in [
     "--release-channel=stable"
-    "--set=build.rustc=${rustPlatform.rust.rustc}/bin/rustc"
-    "--set=build.cargo=${rustPlatform.rust.cargo}/bin/cargo"
+    "--set=build.rustc=${rustc}/bin/rustc"
+    "--set=build.cargo=${cargo}/bin/cargo"
     "--enable-rpath"
     "--enable-vendor"
     "--build=${rust.toRustTargetSpec stdenv.buildPlatform}"
@@ -180,7 +180,7 @@ in stdenv.mkDerivation rec {
   depsBuildBuild = [ pkgsBuildHost.stdenv.cc pkg-config ];
 
   nativeBuildInputs = [
-    file python3 rustPlatform.rust.rustc cmake
+    file python3 rustc cmake
     which libffi removeReferencesTo pkg-config xz
   ];
 
diff --git a/pkgs/development/compilers/rust/rustfmt.nix b/pkgs/development/compilers/rust/rustfmt.nix
index 1ff36e71e82b..4bee49eff5a1 100644
--- a/pkgs/development/compilers/rust/rustfmt.nix
+++ b/pkgs/development/compilers/rust/rustfmt.nix
@@ -1,8 +1,8 @@
-{ lib, stdenv, rustPlatform, Security, asNightly ? false }:
+{ lib, stdenv, rustPlatform, rustc, Security, asNightly ? false }:
 
 rustPlatform.buildRustPackage rec {
   pname = "rustfmt" + lib.optionalString asNightly "-nightly";
-  inherit (rustPlatform.rust.rustc) version src;
+  inherit (rustc) version src;
 
   # the rust source tarball already has all the dependencies vendored, no need to fetch them again
   cargoVendorDir = "vendor";
@@ -12,7 +12,7 @@ rustPlatform.buildRustPackage rec {
   dontUpdateAutotoolsGnuConfigScripts = true;
 
   buildInputs = [
-    rustPlatform.rust.rustc.llvm
+    rustc.llvm
   ] ++ lib.optional stdenv.isDarwin Security;
 
   # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
 
   # As of rustc 1.45.0, these env vars are required to build rustfmt (due to
   # https://github.com/rust-lang/rust/pull/72001)
-  CFG_RELEASE = rustPlatform.rust.rustc.version;
+  CFG_RELEASE = rustc.version;
   CFG_RELEASE_CHANNEL = if asNightly then "nightly" else "stable";
 
   meta = with lib; {