···3535 darwinMinVersionHook,
3636 makeWrapper,
3737 nodejs_22,
3838+ libGL,
3939+ libX11,
4040+ libXext,
4141+ livekit-libwebrtc,
38423943 withGLES ? false,
4044}:
···8993in
9094rustPlatform.buildRustPackage rec {
9195 pname = "zed-editor";
9292- version = "0.165.4";
9696+ version = "0.166.1";
93979498 src = fetchFromGitHub {
9599 owner = "zed-industries";
96100 repo = "zed";
9797- rev = "refs/tags/v${version}";
9898- hash = "sha256-g+ZHchlxeNDkxUM306OK3BsjrvO3snF4vcQQZJSIhLc=";
101101+ tag = "v${version}";
102102+ hash = "sha256-ss4dz9qPAP6eIYbG3S5QJaSR5zEyEqLBjfacj/eb7AE=";
99103 };
100104101101- patches =
102102- [
103103- # Zed uses cargo-install to install cargo-about during the script execution.
104104- # We provide cargo-about ourselves and can skip this step.
105105- # Until https://github.com/zed-industries/zed/issues/19971 is fixed,
106106- # we also skip any crate for which the license cannot be determined.
107107- ./0001-generate-licenses.patch
108108- ]
109109- ++ lib.optionals stdenv.hostPlatform.isDarwin [
110110- # The Swift variant of livekit currently used inside Zed requires
111111- # Swift 6, which is not available in nixpkgs yet:
112112- # https://github.com/NixOS/nixpkgs/issues/343210
113113- # The Rust variant of livekit for Zed is still pending and there is no
114114- # schedule when it will be finished:
115115- # https://github.com/zed-industries/zed/pull/13343
116116- ./0002-disable-livekit-darwin.patch
117117- ];
105105+ patches = [
106106+ # Zed uses cargo-install to install cargo-about during the script execution.
107107+ # We provide cargo-about ourselves and can skip this step.
108108+ # Until https://github.com/zed-industries/zed/issues/19971 is fixed,
109109+ # we also skip any crate for which the license cannot be determined.
110110+ ./0001-generate-licenses.patch
111111+ # See https://github.com/zed-industries/zed/pull/21661#issuecomment-2524161840
112112+ "script/patches/use-cross-platform-livekit.patch"
113113+ ];
114114+115115+ postPatch =
116116+ lib.optionalString stdenv.hostPlatform.isLinux ''
117117+ # Dynamically link WebRTC instead of static
118118+ substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \
119119+ --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc"
120120+ ''
121121+ + lib.optionalString stdenv.hostPlatform.isDarwin ''
122122+ # On Darwin, linking against the dylib results in Rust linker errors, while
123123+ # linking against the framework works fine.
124124+ substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \
125125+ --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=framework=webrtc" \
126126+ --replace-fail 'println!("cargo:rustc-link-search=native={}", webrtc_lib.to_str().unwrap());' \
127127+ 'println!("cargo:rustc-link-search=framework={}/Library/Frameworks", webrtc_dir.to_str().unwrap());'
128128+ '';
118129119130 useFetchCargoVendor = true;
120120- cargoHash = "sha256-ZNXvuHX9b3T58FUs9TjpfiGYNr9J3IDbz2JE6Vy7Sg0=";
131131+ cargoHash = "sha256-HbOdY+6FKGTK5gW2BkWSdciBvTx+oKhCchFvwKEoGNE=";
121132122133 nativeBuildInputs =
123134 [
···151162 libxkbcommon
152163 wayland
153164 xorg.libxcb
165165+ # required by livekit:
166166+ libGL
167167+ libX11
168168+ libXext
154169 ]
155170 ++ lib.optionals stdenv.hostPlatform.isDarwin [
156171 apple-sdk_15
157157- # This will need to be increased to 12.3 once
158158- # https://github.com/zed-industries/zed/pull/13343
159159- # is merged and released, as ScreenCaptureKit is only available on 12.3 and up:
172172+ # ScreenCaptureKit, required by livekit, is only available on 12.3 and up:
160173 # https://developer.apple.com/documentation/screencapturekit
161161- (darwinMinVersionHook "10.15")
174174+ (darwinMinVersionHook "12.3")
162175 ];
163176164177 cargoBuildFlags = [
···183196 ZED_UPDATE_EXPLANATION = "Zed has been installed using Nix. Auto-updates have thus been disabled.";
184197 # Used by `zed --version`
185198 RELEASE_VERSION = version;
199199+ LK_CUSTOM_WEBRTC = livekit-libwebrtc;
186200 };
187201188202 RUSTFLAGS = if withGLES then "--cfg gles" else "";
···286300 passthru = {
287301 updateScript = gitUpdater {
288302 rev-prefix = "v";
289289- ignoredVersions = "pre";
303303+ ignoredVersions = "(*-pre|0.999999.0|0.9999-temporary)";
290304 };
291305 fhs = fhs { };
292306 fhsWithPackages = f: fhs { additionalPkgs = f; };
···295309 meta = {
296310 description = "High-performance, multiplayer code editor from the creators of Atom and Tree-sitter";
297311 homepage = "https://zed.dev";
298298- changelog = "https://github.com/zed-industries/zed/releases/tag/v${version}";
312312+ changelog = "https://github.com/zed-industries/zed/releases/tag/${src.tag}";
299313 license = lib.licenses.gpl3Only;
300314 maintainers = with lib.maintainers; [
301315 GaetanLepage