From 3cbe736ffcde4b0bab3d8550a651d6e5d4af6157 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Mon, 18 Nov 2024 11:38:28 +0100 Subject: [PATCH] zed-editor: 0.165.4 -> 0.166.0-pre --- .../0002-disable-livekit-darwin.patch | 55 ----------------- pkgs/by-name/ze/zed-editor/package.nix | 59 +++++++++++-------- 2 files changed, 34 insertions(+), 80 deletions(-) delete mode 100644 pkgs/by-name/ze/zed-editor/0002-disable-livekit-darwin.patch diff --git a/pkgs/by-name/ze/zed-editor/0002-disable-livekit-darwin.patch b/pkgs/by-name/ze/zed-editor/0002-disable-livekit-darwin.patch deleted file mode 100644 index 2c82a2d49b6882..00000000000000 --- a/pkgs/by-name/ze/zed-editor/0002-disable-livekit-darwin.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/crates/live_kit_client/Cargo.toml b/crates/live_kit_client/Cargo.toml -index e23c63453e..d0142b83d8 100644 ---- a/crates/live_kit_client/Cargo.toml -+++ b/crates/live_kit_client/Cargo.toml -@@ -40,10 +40,10 @@ nanoid = { workspace = true, optional = true} - parking_lot.workspace = true - postage.workspace = true - --[target.'cfg(target_os = "macos")'.dependencies] -+[target.'cfg(target_os = "none")'.dependencies] - core-foundation.workspace = true - --[target.'cfg(all(not(target_os = "macos")))'.dependencies] -+[target.'cfg(all(not(target_os = "none")))'.dependencies] - async-trait = { workspace = true } - collections = { workspace = true } - gpui = { workspace = true } -diff --git a/crates/live_kit_client/build.rs b/crates/live_kit_client/build.rs -index 2fdfd982bf..7272614b87 100644 ---- a/crates/live_kit_client/build.rs -+++ b/crates/live_kit_client/build.rs -@@ -36,7 +36,7 @@ const MACOS_TARGET_VERSION: &str = "10.15.7"; - - fn main() { - if cfg!(all( -- target_os = "macos", -+ target_os = "none", - not(any(test, feature = "test-support", feature = "no-webrtc")), - )) { - let swift_target = get_swift_target(); -diff --git a/crates/live_kit_client/src/live_kit_client.rs b/crates/live_kit_client/src/live_kit_client.rs -index 4820a4eedb..6179e6c55a 100644 ---- a/crates/live_kit_client/src/live_kit_client.rs -+++ b/crates/live_kit_client/src/live_kit_client.rs -@@ -2,16 +2,16 @@ - - use std::sync::Arc; - --#[cfg(all(target_os = "macos", not(any(test, feature = "test-support"))))] -+#[cfg(all(target_os = "none", not(any(test, feature = "test-support"))))] - pub mod prod; - --#[cfg(all(target_os = "macos", not(any(test, feature = "test-support"))))] -+#[cfg(all(target_os = "none", not(any(test, feature = "test-support"))))] - pub use prod::*; - --#[cfg(any(test, feature = "test-support", not(target_os = "macos")))] -+#[cfg(any(test, feature = "test-support", not(target_os = "none")))] - pub mod test; - --#[cfg(any(test, feature = "test-support", not(target_os = "macos")))] -+#[cfg(any(test, feature = "test-support", not(target_os = "none")))] - pub use test::*; - - pub type Sid = String; diff --git a/pkgs/by-name/ze/zed-editor/package.nix b/pkgs/by-name/ze/zed-editor/package.nix index 2a87dae3f59a3a..21b0b186a08fc0 100644 --- a/pkgs/by-name/ze/zed-editor/package.nix +++ b/pkgs/by-name/ze/zed-editor/package.nix @@ -35,6 +35,11 @@ darwinMinVersionHook, makeWrapper, nodejs_22, + libGL, + libX11, + libXext, + livekit-libwebrtc, + fetchpatch, withGLES ? false, }: @@ -89,35 +94,27 @@ let in rustPlatform.buildRustPackage rec { pname = "zed-editor"; - version = "0.165.4"; + version = "0.166.0-pre"; src = fetchFromGitHub { owner = "zed-industries"; repo = "zed"; - rev = "refs/tags/v${version}"; - hash = "sha256-g+ZHchlxeNDkxUM306OK3BsjrvO3snF4vcQQZJSIhLc="; + tag = "v${version}"; + hash = "sha256-ihK5VFZ0NDR+f+23DhccUsZk5pDZYjpCE9psYYc+be0="; }; - patches = - [ - # Zed uses cargo-install to install cargo-about during the script execution. - # We provide cargo-about ourselves and can skip this step. - # 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 - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - # The Swift variant of livekit currently used inside Zed requires - # Swift 6, which is not available in nixpkgs yet: - # https://github.com/NixOS/nixpkgs/issues/343210 - # The Rust variant of livekit for Zed is still pending and there is no - # schedule when it will be finished: - # https://github.com/zed-industries/zed/pull/13343 - ./0002-disable-livekit-darwin.patch - ]; + patches = [ + # Zed uses cargo-install to install cargo-about during the script execution. + # We provide cargo-about ourselves and can skip this step. + # 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 + # See https://github.com/zed-industries/zed/pull/21661#issuecomment-2524161840 + "script/patches/use-cross-platform-livekit.patch" + ]; useFetchCargoVendor = true; - cargoHash = "sha256-ZNXvuHX9b3T58FUs9TjpfiGYNr9J3IDbz2JE6Vy7Sg0="; + cargoHash = "sha256-Of9WQ2f9fKwjUQuoSeJMH64Y35VL+xgIf6H5r+MKtAE="; nativeBuildInputs = [ @@ -151,14 +148,16 @@ rustPlatform.buildRustPackage rec { libxkbcommon wayland xorg.libxcb + # required by livekit: + libGL + libX11 + libXext ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 - # This will need to be increased to 12.3 once - # https://github.com/zed-industries/zed/pull/13343 - # is merged and released, as ScreenCaptureKit is only available on 12.3 and up: + # ScreenCaptureKit, required by livekit, is only available on 12.3 and up: # https://developer.apple.com/documentation/screencapturekit - (darwinMinVersionHook "10.15") + (darwinMinVersionHook "12.3") ]; cargoBuildFlags = [ @@ -183,6 +182,16 @@ rustPlatform.buildRustPackage rec { ZED_UPDATE_EXPLANATION = "Zed has been installed using Nix. Auto-updates have thus been disabled."; # Used by `zed --version` RELEASE_VERSION = version; + LK_CUSTOM_WEBRTC = livekit-libwebrtc.overrideAttrs ( + finalAttrs: prevAttrs: { + patches = prevAttrs.patches ++ [ + (fetchpatch { + url = "https://github.com/zed-industries/webrtc/commit/08f7a701a2eda6407670508fc2154257a3c90308.patch"; + hash = "sha256-oWYZLwqjRSHDt92MqsxsoBSMyZKj1ubNbOXZRbPpbEw="; + }) + ]; + } + ); }; RUSTFLAGS = if withGLES then "--cfg gles" else "";