Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Jakub Konkaa17a1c10c875
diff --git a/nix/build.nix b/nix/build.nix
index 02ed6235e54..9270abbe6f7 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 dd7b5808ac6..4c0d9992620 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";