Unverified Commit d662d570 authored by yaya's avatar yaya Committed by GitHub
Browse files

cherry-studio: 1.7.9 -> 1.8.4 (#500731)

parents 42caa1d0 2ac41218
Loading
Loading
Loading
Loading
+0 −164

File deleted.

Preview size limit exceeded, changes collapsed.

+51 −24
Original line number Diff line number Diff line
@@ -2,31 +2,42 @@
  lib,
  stdenv,
  fetchFromGitHub,
  yarn-berry_4,
  fetchPnpmDeps,
  electron_40,
  nodejs,
  electron_38,
  cctools,
  autoPatchelfHook,
  pnpm_10_29_2,
  pnpmConfigHook,
  makeWrapper,
  writableTmpDirAsHomeHook,
  makeDesktopItem,
  copyDesktopItems,
  cctools,
  autoPatchelfHook,
  pkg-config,
  makeDesktopItem,
  nix-update-script,
  alsa-lib,
  libevdev,
  libx11,
  libxi,
  libxfixes,
  libxtst,
  wayland,
  commandLineArgs ? "",
}:

let
  electron = electron_38;
  yarn-berry = yarn-berry_4;
  electron = electron_40;
  pnpm = pnpm_10_29_2;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "cherry-studio";
  version = "1.7.9";
  version = "1.8.4";

  src = fetchFromGitHub {
    owner = "CherryHQ";
    repo = "cherry-studio";
    tag = "v${finalAttrs.version}";
    hash = "sha256-q/heW5o2IWFjsDed/SaMv5Xfm5kAP14RD1hALkipu+Q=";
    hash = "sha256-TLV4N9WYuTD24UY+2lYmxRLO2jtdvuXyIOeH5mXb1V0=";
  };

  postPatch = ''
@@ -39,32 +50,48 @@ stdenv.mkDerivation (finalAttrs: {
      --replace-fail "isAutoUpdate)" "false)"
  '';

  missingHashes = ./missing-hashes.json;

  offlineCache = yarn-berry.fetchYarnBerryDeps {
    inherit (finalAttrs) src missingHashes;
    hash = "sha256-AYKgGe9iTcXJqS019D064TRb5aY/XTS8u847LcYisa4=";
  pnpmDeps = fetchPnpmDeps {
    inherit (finalAttrs) pname version src;
    inherit pnpm;
    fetcherVersion = 3;
    hash = "sha256-qryToH1tytLSwPORkLBCCn3m/Xsl+vift9WF3Pn8oGg=";
  };

  nativeBuildInputs = [
    yarn-berry.yarnBerryConfigHook
    yarn-berry
    nodejs
    (nodejs.python.withPackages (ps: with ps; [ setuptools ]))
    pnpm
    pnpmConfigHook
    makeWrapper
    writableTmpDirAsHomeHook
    copyDesktopItems
    nodejs
    (nodejs.python.withPackages (ps: with ps; [ setuptools ]))
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [ cctools.libtool ]
  ++ lib.optionals stdenv.hostPlatform.isElf [ autoPatchelfHook ];
  ++ lib.optionals stdenv.hostPlatform.isElf [
    autoPatchelfHook
    pkg-config
  ];

  buildInputs = lib.optionals stdenv.hostPlatform.isElf [ stdenv.cc.cc.lib ];
  buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
    stdenv.cc.cc.lib
    alsa-lib
    libevdev
    libx11
    libxi
    libxtst
    libxfixes
    wayland
  ];

  autoPatchelfIgnoreMissingDeps = [
    "libc.musl-*.so.*"
  ];

  strictDeps = true;

  env = {
    YARN_ENABLE_SCRIPTS = "false";
    ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
    NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux "-I${lib.getDev libevdev}/include/libevdev-1.0";
  };

  buildPhase = ''
@@ -73,8 +100,8 @@ stdenv.mkDerivation (finalAttrs: {
    cp -r "${electron.dist}" $HOME/.electron-dist
    chmod -R u+w $HOME/.electron-dist

    yarn run electron-vite build
    yarn run electron-builder --dir \
    node_modules/.bin/electron-vite build
    npm_config_nodedir=${electron.headers} npm_config_build_from_source=true node_modules/.bin/electron-builder --dir \
      --config=electron-builder.yml \
      --config.mac.identity=null \
      --config.electronDist="$HOME/.electron-dist" \
@@ -123,7 +150,7 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  passthru.updateScript = ./update.sh;
  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Desktop client that supports for multiple LLM providers";
+0 −28
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused jq nix bash coreutils nix-update yarn-berry.yarn-berry-fetcher

set -eou pipefail

PACKAGE_DIR=$(realpath $(dirname $0))

latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/CherryHQ/cherry-studio/releases/latest | jq --raw-output .tag_name)
latestVersion=$(echo "$latestTag" | sed 's/^v//')

currentVersion=$(nix-instantiate --eval -E "with import ./. {}; cherry-studio.version or (lib.getVersion cherry-studio)" | tr -d '"')

if [[ "$currentVersion" == "$latestVersion" ]]; then
    echo "package is up-to-date: $currentVersion"
    exit 0
fi

nix-update cherry-studio --version "$latestVersion" || true

export HOME=$(mktemp -d)
src=$(nix-build --no-link $PWD -A cherry-studio.src)
WORKDIR=$(mktemp -d)
cp --recursive --no-preserve=mode $src/* $WORKDIR
pushd $WORKDIR
yarn-berry-fetcher missing-hashes yarn.lock >$PACKAGE_DIR/missing-hashes.json
popd

nix-update cherry-studio --version skip || true