From 73ac3d9a99f7bfa3cb1d2ff5824f975c9dce2288 Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Tue, 18 Mar 2025 17:04:27 -0700 Subject: [PATCH] nix: Fix LDFLAGS rpath (#26912) By default stdenv strips all unused rpaths, but we use a few libraries that are `dlopen`'d so we need to stop it from removing those. The [`dontPatchELF` flag](https://ryantm.github.io/nixpkgs/stdenv/stdenv/#var-stdenv-dontPatchELF) disables that and makes the nix build work on wayland again. Fix #26905 Close #26864 Release Notes: - N/A --- nix/build.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/build.nix b/nix/build.nix index 940623894d..422f12b4c2 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -145,7 +145,7 @@ let ZED_UPDATE_EXPLANATION = "Zed has been installed using Nix. Auto-updates have thus been disabled."; RELEASE_VERSION = version; RUSTFLAGS = if withGLES then "--cfg gles" else ""; - # TODO: why are these not handled by the linker given that they're in buildInputs? + # these libraries are used with dlopen so putting them in buildInputs isn't enough NIX_LDFLAGS = "-rpath ${ lib.makeLibraryPath [ gpu-lib @@ -155,6 +155,9 @@ let LK_CUSTOM_WEBRTC = livekit-libwebrtc; }; + # prevent nix from removing the "unused" wayland/gpu-lib rpaths + dontPatchELF = true; + cargoVendorDir = craneLib.vendorCargoDeps { inherit src cargoLock; overrideVendorGitCheckout =