Unverified Commit 3d8541df authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

zed-editor: fix license menu and `--version` (#339766)

parents 6c4ea7a3 afce6125
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
diff --git a/script/generate-licenses b/script/generate-licenses
index 43b2f5c458..c740a3afa2 100755
--- a/script/generate-licenses
+++ b/script/generate-licenses
@@ -15,12 +15,6 @@ cat assets/icons/LICENSES >> $OUTPUT_FILE
 
 echo -e "# ###### CODE LICENSES ######\n" >> $OUTPUT_FILE
 
-if ! cargo install --list | grep "cargo-about v$CARGO_ABOUT_VERSION" > /dev/null; then
-  echo "Installing cargo-about@$CARGO_ABOUT_VERSION..."
-  cargo install "cargo-about@$CARGO_ABOUT_VERSION"
-else
-  echo "cargo-about@$CARGO_ABOUT_VERSION is already installed."
-fi
 
 echo "Generating cargo licenses"
 cargo about generate --fail -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md >> $OUTPUT_FILE
+27 −5
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@
  vulkan-loader,
  envsubst,
  nix-update-script,
  cargo-about,
  testers,
  zed-editor,

  withGLES ? false,
}:
@@ -45,6 +48,12 @@ rustPlatform.buildRustPackage rec {
    fetchSubmodules = true;
  };

  patches = [
    # Zed uses cargo-install to install cargo-about during the script execution.
    # We provide cargo-about ourselves and can skip this step.
    ./0001-generate-licenses.patch
  ];

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
@@ -73,6 +82,7 @@ rustPlatform.buildRustPackage rec {
    pkg-config
    protobuf
    rustPlatform.bindgenHook
    cargo-about
  ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ];

  buildInputs =
@@ -128,11 +138,17 @@ rustPlatform.buildRustPackage rec {
    # 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 = version;
  };

  RUSTFLAGS = if withGLES then "--cfg gles" else "";
  gpu-lib = if withGLES then libglvnd else vulkan-loader;

  preBuild = ''
    bash script/generate-licenses
  '';

  postFixup = lib.optionalString stdenv.isLinux ''
    patchelf --add-rpath ${gpu-lib}/lib $out/libexec/*
    patchelf --add-rpath ${wayland}/lib $out/libexec/*
@@ -175,12 +191,18 @@ rustPlatform.buildRustPackage rec {
    runHook postInstall
  '';

  passthru.updateScript = nix-update-script {
  passthru = {
    updateScript = nix-update-script {
      extraArgs = [
        "--version-regex"
        "v(.*)"
      ];
    };
    tests.version = testers.testVersion {
      inherit version;
      package = zed-editor;
    };
  };

  meta = {
    description = "High-performance, multiplayer code editor from the creators of Atom and Tree-sitter";