diff options
author | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2023-11-12 22:13:26 +0100 |
---|---|---|
committer | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2023-11-12 22:13:26 +0100 |
commit | c1eb661271bf5c3e0baa7b32ebd9d455883d95d0 (patch) | |
tree | ab5d2940d1d554bffbe0e964f7a9d70e8e8b4d10 /pkgs/development/compilers/rust | |
parent | cbede4e908da717f45deb12cf47796e3170e9920 (diff) | |
parent | b0e3e12d6c672ed87dd5a02501cc00c5412b1181 (diff) | |
download | nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.tar nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.tar.gz nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.tar.bz2 nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.tar.lz nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.tar.xz nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.tar.zst nixlib-c1eb661271bf5c3e0baa7b32ebd9d455883d95d0.zip |
Merge branch 'master' into staging-next
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r-- | pkgs/development/compilers/rust/default.nix | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/rustc.nix | 22 |
2 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index 0a0af7832366..efd7042c230c 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -73,7 +73,7 @@ in patches = rustcPatches; # Use boot package set to break cycle - inherit (bootstrapRustPackages) cargo rustc; + inherit (bootstrapRustPackages) cargo rustc rustfmt; }); rustfmt = self.callPackage ./rustfmt.nix { inherit Security; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 5f97b0f4019d..1758abb6bea5 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, cargo, cmake, rustc +, darwin, cargo, cmake, rustc, rustfmt , pkg-config, openssl, xz , libiconv , which, libffi @@ -24,13 +24,15 @@ let inherit (lib) optionals optional optionalString concatStringsSep; inherit (darwin.apple_sdk.frameworks) Security; -in stdenv.mkDerivation rec { +in stdenv.mkDerivation (finalAttrs: { pname = "${targetPackages.stdenv.cc.targetPrefix}rustc"; inherit version; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; inherit sha256; + # See https://nixos.org/manual/nixpkgs/stable/#using-git-bisect-on-the-rust-compiler + passthru.isReleaseTarball = true; }; __darwinAllowLocalNetworking = true; @@ -82,6 +84,12 @@ in stdenv.mkDerivation rec { "--release-channel=stable" "--set=build.rustc=${rustc}/bin/rustc" "--set=build.cargo=${cargo}/bin/cargo" + ] ++ lib.optionals (!(finalAttrs.src.passthru.isReleaseTarball or false)) [ + # release tarballs vendor the rustfmt source; when + # git-bisect'ing from upstream's git repo we must prevent + # attempts to download the missing source tarball + "--set=build.rustfmt=${rustfmt}/bin/rustfmt" + ] ++ [ "--tools=rustc,rust-analyzer-proc-macro-srv" "--enable-rpath" "--enable-vendor" @@ -206,6 +214,14 @@ in stdenv.mkDerivation rec { # See https://github.com/jemalloc/jemalloc/issues/1997 # Using a value of 48 should work on both emulated and native x86_64-darwin. export JEMALLOC_SYS_WITH_LG_VADDR=48 + '' + lib.optionalString (!(finalAttrs.src.passthru.isReleaseTarball or false)) '' + mkdir .cargo + cat > .cargo/config <<\EOF + [source.crates-io] + replace-with = "vendored-sources" + [source.vendored-sources] + directory = "vendor" + EOF ''; # rustc unfortunately needs cmake to compile llvm-rt but doesn't @@ -283,4 +299,4 @@ in stdenv.mkDerivation rec { "i686-windows" "x86_64-windows" ]; }; -} +}) |