summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorTobias Happ <tobias.happ@gmx.de>2020-08-31 19:49:52 +0200
committerJon <jonringer@users.noreply.github.com>2020-09-02 10:57:35 -0700
commitb2679e8b4166c9fc08ca9a27b0ceb8f874842904 (patch)
treef390144b50f7c9a5a1a55ad3df9233fb3819f634 /pkgs
parentf9bf64f0c4ab3b0eeb7bc65950090272606f2547 (diff)
downloadnixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.tar
nixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.tar.gz
nixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.tar.bz2
nixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.tar.lz
nixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.tar.xz
nixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.tar.zst
nixpkgs-b2679e8b4166c9fc08ca9a27b0ceb8f874842904.zip
rustup: add zlib as runtime dependency
Fixes https://github.com/NixOS/nixpkgs/issues/92946.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/rust/rustup/default.nix30
1 files changed, 16 insertions, 14 deletions
diff --git a/pkgs/development/tools/rust/rustup/default.nix b/pkgs/development/tools/rust/rustup/default.nix
index a51975b85ca..e5ef80b87ee 100644
--- a/pkgs/development/tools/rust/rustup/default.nix
+++ b/pkgs/development/tools/rust/rustup/default.nix
@@ -1,7 +1,13 @@
 { stdenv, lib, runCommand, patchelf
-, fetchFromGitHub, rustPlatform
+, fetchFromGitHub, rustPlatform, makeWrapper
 , pkgconfig, curl, zlib, Security, CoreServices }:
 
+let
+  libPath = lib.makeLibraryPath [
+    zlib # libz.so.1
+  ];
+in
+
 rustPlatform.buildRustPackage rec {
   pname = "rustup";
   version = "1.22.1";
@@ -15,7 +21,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "0ghjrx7y25s6rjp06h0iyv4195x7daj57bqza01i1j4hm5nkhqhi";
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ makeWrapper pkgconfig ];
 
   buildInputs = [
     curl zlib
@@ -24,19 +30,13 @@ rustPlatform.buildRustPackage rec {
   cargoBuildFlags = [ "--features no-self-update" ];
 
   patches = lib.optionals stdenv.isLinux [
-    (let
-      libPath = lib.makeLibraryPath [
-        zlib # libz.so.1
-      ];
-    in
-      (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } ''
-       export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
-       substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
-         --subst-var patchelf \
-         --subst-var dynamicLinker \
-         --subst-var libPath
+    (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } ''
+     export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
+     substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
+       --subst-var patchelf \
+       --subst-var dynamicLinker \
+       --subst-var libPath
     '')
-    )
   ];
 
   doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;
@@ -53,6 +53,8 @@ rustPlatform.buildRustPackage rec {
     done
     popd
 
+    wrapProgram $out/bin/rustup --prefix "LD_LIBRARY_PATH" : "${libPath}"
+
     # tries to create .rustup
     export HOME=$(mktemp -d)
     mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}