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

authored by Gaétan Lepage and committed by GitHub 3d8541df 6c4ea7a3

+44 -5
+17
pkgs/by-name/ze/zed-editor/0001-generate-licenses.patch
··· 1 + diff --git a/script/generate-licenses b/script/generate-licenses 2 + index 43b2f5c458..c740a3afa2 100755 3 + --- a/script/generate-licenses 4 + +++ b/script/generate-licenses 5 + @@ -15,12 +15,6 @@ cat assets/icons/LICENSES >> $OUTPUT_FILE 6 + 7 + echo -e "# ###### CODE LICENSES ######\n" >> $OUTPUT_FILE 8 + 9 + -if ! cargo install --list | grep "cargo-about v$CARGO_ABOUT_VERSION" > /dev/null; then 10 + - echo "Installing cargo-about@$CARGO_ABOUT_VERSION..." 11 + - cargo install "cargo-about@$CARGO_ABOUT_VERSION" 12 + -else 13 + - echo "cargo-about@$CARGO_ABOUT_VERSION is already installed." 14 + -fi 15 + 16 + echo "Generating cargo licenses" 17 + cargo about generate --fail -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md >> $OUTPUT_FILE
+27 -5
pkgs/by-name/ze/zed-editor/package.nix
··· 27 27 vulkan-loader, 28 28 envsubst, 29 29 nix-update-script, 30 + cargo-about, 31 + testers, 32 + zed-editor, 30 33 31 34 withGLES ? false, 32 35 }: ··· 45 48 fetchSubmodules = true; 46 49 }; 47 50 51 + patches = [ 52 + # Zed uses cargo-install to install cargo-about during the script execution. 53 + # We provide cargo-about ourselves and can skip this step. 54 + ./0001-generate-licenses.patch 55 + ]; 56 + 48 57 cargoLock = { 49 58 lockFile = ./Cargo.lock; 50 59 outputHashes = { ··· 73 82 pkg-config 74 83 protobuf 75 84 rustPlatform.bindgenHook 85 + cargo-about 76 86 ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ]; 77 87 78 88 buildInputs = ··· 128 138 # Setting this environment variable allows to disable auto-updates 129 139 # https://zed.dev/docs/development/linux#notes-for-packaging-zed 130 140 ZED_UPDATE_EXPLANATION = "zed has been installed using nix. Auto-updates have thus been disabled."; 141 + # Used by `zed --version` 142 + RELEASE_VERSION = version; 131 143 }; 132 144 133 145 RUSTFLAGS = if withGLES then "--cfg gles" else ""; 134 146 gpu-lib = if withGLES then libglvnd else vulkan-loader; 147 + 148 + preBuild = '' 149 + bash script/generate-licenses 150 + ''; 135 151 136 152 postFixup = lib.optionalString stdenv.isLinux '' 137 153 patchelf --add-rpath ${gpu-lib}/lib $out/libexec/* ··· 175 191 runHook postInstall 176 192 ''; 177 193 178 - passthru.updateScript = nix-update-script { 179 - extraArgs = [ 180 - "--version-regex" 181 - "v(.*)" 182 - ]; 194 + passthru = { 195 + updateScript = nix-update-script { 196 + extraArgs = [ 197 + "--version-regex" 198 + "v(.*)" 199 + ]; 200 + }; 201 + tests.version = testers.testVersion { 202 + inherit version; 203 + package = zed-editor; 204 + }; 183 205 }; 184 206 185 207 meta = {