From cf43519972e2b6c9ca935aaee7a9c6f0cb69736c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 1 Jul 2020 15:54:27 +0200 Subject: [PATCH] rust-overlay: Fix missing libz.so.1 --- rust-overlay.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rust-overlay.nix b/rust-overlay.nix index f62d5ba..6a3edb9 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -175,9 +175,19 @@ let if [[ "$i" =~ .build-id ]]; then continue; fi if ! isELF "$i"; then continue; fi echo "setting interpreter of $i" - patchelf \ - --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - "$i" || true + + if [[ -x "$i" ]]; then + # Handle executables + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${super.lib.makeLibraryPath [ self.zlib ]}:$out/lib" \ + "$i" || true + else + # Handle libraries + patchelf \ + --set-rpath "${super.lib.makeLibraryPath [ self.zlib ]}:$out/lib" \ + "$i" || true + fi done < <(find "$dir" -type f -print0) }