From 9cb3ccd803bf39ecef2e996bb645e13c5f8c0167 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Fri, 21 Feb 2025 10:11:56 +0100 Subject: [PATCH] zed-editor: disable linker override on linux (cherry picked from commit c8f52a6def729a54e13125dfaf0f51ebb48eca54) --- .../ze/zed-editor/0002-linux-linker.patch | 19 +++++++++++++++++++ pkgs/by-name/ze/zed-editor/package.nix | 8 ++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/ze/zed-editor/0002-linux-linker.patch diff --git a/pkgs/by-name/ze/zed-editor/0002-linux-linker.patch b/pkgs/by-name/ze/zed-editor/0002-linux-linker.patch new file mode 100644 index 000000000000..4529e038dc2f --- /dev/null +++ b/pkgs/by-name/ze/zed-editor/0002-linux-linker.patch @@ -0,0 +1,19 @@ +diff --git a/.cargo/config.toml b/.cargo/config.toml +index 07cbc23195..b3c4d43e0f 100644 +--- a/.cargo/config.toml ++++ b/.cargo/config.toml +@@ -5,14 +5,6 @@ rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"] + [alias] + xtask = "run --package xtask --" + +-[target.x86_64-unknown-linux-gnu] +-linker = "clang" +-rustflags = ["-C", "link-arg=-fuse-ld=mold"] +- +-[target.aarch64-unknown-linux-gnu] +-linker = "clang" +-rustflags = ["-C", "link-arg=-fuse-ld=mold"] +- + [target.aarch64-apple-darwin] + rustflags = ["-C", "link-args=-Objc -all_load"] + diff --git a/pkgs/by-name/ze/zed-editor/package.nix b/pkgs/by-name/ze/zed-editor/package.nix index 2ea23820247b..e20319e1cc42 100644 --- a/pkgs/by-name/ze/zed-editor/package.nix +++ b/pkgs/by-name/ze/zed-editor/package.nix @@ -41,7 +41,6 @@ livekit-libwebrtc, testers, writableTmpDirAsHomeHook, - clang, withGLES ? false, buildRemoteServer ? true, @@ -114,6 +113,12 @@ rustPlatform.buildRustPackage rec { # Until https://github.com/zed-industries/zed/issues/19971 is fixed, # we also skip any crate for which the license cannot be determined. ./0001-generate-licenses.patch + + # Upstream delegates linking on Linux to clang to make use of mold, + # but builds fine with our standard linker. + # This patch removes their linker override from the cargo config. + ./0002-linux-linker.patch + # See https://github.com/zed-industries/zed/pull/21661#issuecomment-2524161840 "script/patches/use-cross-platform-livekit.patch" ]; @@ -129,7 +134,6 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ - clang cmake copyDesktopItems curl