From a17a1c10c87519676a65de7a46106520f13f22f3 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 30 Mar 2026 07:50:20 +0200 Subject: [PATCH] nix: Fix screen-casting when building Zed with nix (#52690) Release Notes: - Fixed screen-casting when building Zed with Nix. --- nix/build.nix | 8 ++++---- nix/livekit-libwebrtc/package.nix | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nix/build.nix b/nix/build.nix index 02ed6235e54daa27a9af9b86da79618a21e3cc7e..9270abbe6f747e0ed78400d13561eadd97edd184 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -77,6 +77,7 @@ let builtins.elem firstComp topLevelIncludes; craneLib = crane.overrideToolchain rustToolchain; + gpu-lib = if withGLES then libglvnd else vulkan-loader; commonArgs = let zedCargoLock = builtins.fromTOML (builtins.readFile ../crates/zed/Cargo.toml); @@ -178,8 +179,8 @@ let libva libxkbcommon wayland + gpu-lib libglvnd - vulkan-loader xorg.libX11 xorg.libxcb libdrm @@ -236,8 +237,7 @@ let # about them that's special is that they're manually dlopened at runtime NIX_LDFLAGS = lib.optionalString stdenv'.hostPlatform.isLinux "-rpath ${ lib.makeLibraryPath [ - libglvnd - vulkan-loader + gpu-lib wayland libva ] @@ -246,7 +246,7 @@ let NIX_OUTPATH_USED_AS_RANDOM_SEED = "norebuilds"; }; - # prevent nix from removing the "unused" wayland rpaths + # prevent nix from removing the "unused" wayland/gpu-lib rpaths dontPatchELF = stdenv'.hostPlatform.isLinux; # TODO: try craneLib.cargoNextest separate output diff --git a/nix/livekit-libwebrtc/package.nix b/nix/livekit-libwebrtc/package.nix index dd7b5808ac65ab07d1293683905b694910ee503a..4c0d99926200e619b567cf7a90549f4f882eda42 100644 --- a/nix/livekit-libwebrtc/package.nix +++ b/nix/livekit-libwebrtc/package.nix @@ -81,6 +81,15 @@ stdenv.mkDerivation { pname = "livekit-libwebrtc"; version = "137-unstable-2025-11-24"; + # libwebrtc loads libEGL/libGL at runtime via dlopen() in the Wayland + # screencast path, so they are not visible as ordinary DT_NEEDED edges. + # Keep an explicit rpath so the shared object can resolve them at runtime. + NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux + "-rpath ${lib.makeLibraryPath [ libGL ]}"; + + # Prevent fixup from stripping the rpath above as "unused". + dontPatchELF = stdenv.hostPlatform.isLinux; + gclientDeps = gclient2nix.importGclientDeps ./sources.json; sourceRoot = "src";