nix: Fix screen-casting when building Zed with nix (#52690)

Release Notes:

- Fixed screen-casting when building Zed with Nix.
This commit is contained in:
Jakub Konka 2026-03-30 07:50:20 +02:00 committed by GitHub
parent 3060e4170e
commit a17a1c10c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View file

@ -77,6 +77,7 @@ let
builtins.elem firstComp topLevelIncludes; builtins.elem firstComp topLevelIncludes;
craneLib = crane.overrideToolchain rustToolchain; craneLib = crane.overrideToolchain rustToolchain;
gpu-lib = if withGLES then libglvnd else vulkan-loader;
commonArgs = commonArgs =
let let
zedCargoLock = builtins.fromTOML (builtins.readFile ../crates/zed/Cargo.toml); zedCargoLock = builtins.fromTOML (builtins.readFile ../crates/zed/Cargo.toml);
@ -178,8 +179,8 @@ let
libva libva
libxkbcommon libxkbcommon
wayland wayland
gpu-lib
libglvnd libglvnd
vulkan-loader
xorg.libX11 xorg.libX11
xorg.libxcb xorg.libxcb
libdrm libdrm
@ -236,8 +237,7 @@ let
# about them that's special is that they're manually dlopened at runtime # about them that's special is that they're manually dlopened at runtime
NIX_LDFLAGS = lib.optionalString stdenv'.hostPlatform.isLinux "-rpath ${ NIX_LDFLAGS = lib.optionalString stdenv'.hostPlatform.isLinux "-rpath ${
lib.makeLibraryPath [ lib.makeLibraryPath [
libglvnd gpu-lib
vulkan-loader
wayland wayland
libva libva
] ]
@ -246,7 +246,7 @@ let
NIX_OUTPATH_USED_AS_RANDOM_SEED = "norebuilds"; 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; dontPatchELF = stdenv'.hostPlatform.isLinux;
# TODO: try craneLib.cargoNextest separate output # TODO: try craneLib.cargoNextest separate output

View file

@ -81,6 +81,15 @@ stdenv.mkDerivation {
pname = "livekit-libwebrtc"; pname = "livekit-libwebrtc";
version = "137-unstable-2025-11-24"; 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; gclientDeps = gclient2nix.importGclientDeps ./sources.json;
sourceRoot = "src"; sourceRoot = "src";