summary refs log tree commit diff
path: root/pkgs/development/tools/rust/rustup/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/rust/rustup/default.nix')
-rw-r--r--pkgs/development/tools/rust/rustup/default.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/pkgs/development/tools/rust/rustup/default.nix b/pkgs/development/tools/rust/rustup/default.nix
index 959eb6875ce..688159445d5 100644
--- a/pkgs/development/tools/rust/rustup/default.nix
+++ b/pkgs/development/tools/rust/rustup/default.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, runCommand, patchelf
 , fetchFromGitHub, rustPlatform
-, pkgconfig, curl, Security, CoreServices }:
+, pkgconfig, curl, zlib, Security, CoreServices }:
 
 rustPlatform.buildRustPackage rec {
   pname = "rustup";
@@ -18,18 +18,25 @@ rustPlatform.buildRustPackage rec {
   nativeBuildInputs = [ pkgconfig ];
 
   buildInputs = [
-    curl
+    curl zlib
   ] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices Security ];
 
   cargoBuildFlags = [ "--features no-self-update" ];
 
   patches = lib.optionals stdenv.isLinux [
-    (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; } ''
+    (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 dynamicLinker \
+         --subst-var libPath
     '')
+    )
   ];
 
   doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;