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
This commit is contained in:
Julia Ryan 2025-03-18 17:04:27 -07:00 committed by GitHub
parent 2269f996f7
commit 73ac3d9a99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 =