diff --git a/pkgs/by-name/ze/zed-editor/package.nix b/pkgs/by-name/ze/zed-editor/package.nix index 1e740abbe371..6fb9adc99e46 100644 --- a/pkgs/by-name/ze/zed-editor/package.nix +++ b/pkgs/by-name/ze/zed-editor/package.nix @@ -3,13 +3,9 @@ rustPlatform, fetchFromGitHub, cmake, - copyDesktopItems, - curl, - perl, pkg-config, protobuf, fontconfig, - freetype, libgit2, openssl, sqlite, @@ -19,10 +15,8 @@ alsa-lib, libxkbcommon, wayland, - libglvnd, libxcb, stdenv, - makeFontsConf, vulkan-loader, envsubst, nix-update-script, @@ -31,8 +25,6 @@ buildFHSEnv, cargo-bundle, git, - apple-sdk_15, - darwinMinVersionHook, makeBinaryWrapper, nodejs, libGL, @@ -42,13 +34,9 @@ testers, writableTmpDirAsHomeHook, - withGLES ? false, buildRemoteServer ? true, - zed-editor, }: -assert withGLES -> stdenv.hostPlatform.isLinux; - let channel = "stable"; executableName = "zeditor"; @@ -106,8 +94,6 @@ let ''; }; }; - - gpu-lib = if withGLES then libglvnd else vulkan-loader; in rustPlatform.buildRustPackage (finalAttrs: { pname = "zed-editor"; @@ -152,14 +138,12 @@ rustPlatform.buildRustPackage (finalAttrs: { cargoHash = "sha256-++2q4zeLBDSW4ooTu7dU77YsuHggeX/sWkvuCb3PF50="; + __structuredAttrs = true; + nativeBuildInputs = [ cmake - copyDesktopItems - curl - perl pkg-config protobuf - rustPlatform.bindgenHook cargo-about ] ++ lib.optionals stdenv.hostPlatform.isLinux [ makeBinaryWrapper ] @@ -168,16 +152,14 @@ rustPlatform.buildRustPackage (finalAttrs: { dontUseCmakeConfigure = true; buildInputs = [ - curl - fontconfig - freetype libgit2 - openssl sqlite zlib zstd ] ++ lib.optionals stdenv.hostPlatform.isLinux [ + fontconfig + openssl glib alsa-lib libxkbcommon @@ -187,12 +169,6 @@ rustPlatform.buildRustPackage (finalAttrs: { libGL libx11 libxext - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - apple-sdk_15 - # ScreenCaptureKit, required by livekit, is only available on 12.3 and up: - # https://developer.apple.com/documentation/screencapturekit - (darwinMinVersionHook "12.3") ]; cargoBuildFlags = [ @@ -216,20 +192,16 @@ rustPlatform.buildRustPackage (finalAttrs: { env = { ALLOW_MISSING_LICENSES = true; + OPENSSL_NO_VENDOR = true; + LIBGIT2_NO_VENDOR = true; + LIBSQLITE3_SYS_USE_PKG_CONFIG = true; ZSTD_SYS_USE_PKG_CONFIG = true; - FONTCONFIG_FILE = makeFontsConf { - fontDirectories = [ - "${finalAttrs.src}/assets/fonts/plex-mono" - "${finalAttrs.src}/assets/fonts/plex-sans" - ]; - }; # Setting this environment variable allows to disable auto-updates # https://zed.dev/docs/development/linux#notes-for-packaging-zed ZED_UPDATE_EXPLANATION = "Zed has been installed using Nix. Auto-updates have thus been disabled."; # Used by `zed --version` RELEASE_VERSION = finalAttrs.version; LK_CUSTOM_WEBRTC = livekit-libwebrtc; - RUSTFLAGS = lib.optionalString withGLES "--cfg gles"; }; preBuild = '' @@ -237,8 +209,13 @@ rustPlatform.buildRustPackage (finalAttrs: { ''; postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' - patchelf --add-rpath ${gpu-lib}/lib $out/libexec/* - patchelf --add-rpath ${wayland}/lib $out/libexec/* + patchelf $out/libexec/zed-editor --add-rpath ${ + lib.makeLibraryPath [ + libGL + vulkan-loader + wayland + ] + } wrapProgram $out/libexec/zed-editor --suffix PATH : ${lib.makeBinPath [ nodejs ]} ''; @@ -259,21 +236,10 @@ rustPlatform.buildRustPackage (finalAttrs: { mv $release_target/zed target/release/zed pushd crates/zed - # Note that this is GNU sed, while Zed's bundle-mac uses BSD sed sed -i "s/package.metadata.bundle-stable/package.metadata.bundle/" Cargo.toml export CARGO_BUNDLE_SKIP_BUILD=true app_path=$(cargo bundle --release | xargs) - - # We're not using Zed's fork of cargo-bundle, so we must manually append their plist extensions - # Remove closing tags from Info.plist (last two lines) - head -n -2 $app_path/Contents/Info.plist > Info.plist - # Append extensions - cat resources/info/*.plist >> Info.plist - # Add closing tags - printf "\n\n" >> Info.plist - mv Info.plist $app_path/Contents/Info.plist - popd mkdir -p $out/Applications $out/bin @@ -290,7 +256,7 @@ rustPlatform.buildRustPackage (finalAttrs: { install -Dm755 $release_target/zed $out/libexec/zed-editor install -Dm755 $release_target/cli $out/bin/zeditor - install -Dm644 $src/crates/zed/resources/app-icon@2x.png $out/share/icons/hicolor/1024x1024@2x/apps/zed.png + install -Dm644 $src/crates/zed/resources/app-icon@2x.png $out/share/icons/hicolor/512x512@2x/apps/zed.png install -Dm644 $src/crates/zed/resources/app-icon.png $out/share/icons/hicolor/512x512/apps/zed.png # extracted from https://github.com/zed-industries/zed/blob/v0.141.2/script/bundle-linux (envsubst) @@ -342,9 +308,6 @@ rustPlatform.buildRustPackage (finalAttrs: { package = finalAttrs.finalPackage.remote_server; command = "${finalAttrs.remoteServerExecutableName} version"; }; - } - // lib.optionalAttrs stdenv.hostPlatform.isLinux { - withGles = zed-editor.override { withGLES = true; }; }; };