From 7f39ddf2ac06086f94c601e5dbc5b946e2500968 Mon Sep 17 00:00:00 2001 From: Nivayu Date: Fri, 23 Jan 2026 17:27:09 +0100 Subject: [PATCH] synology-drive-client: 4.0.1-17885 -> 4.0.2-17889 --- .../sy/synology-drive-client/package.nix | 43 +++++++------------ .../sy/synology-drive-client/update.sh | 22 ++++++++++ 2 files changed, 37 insertions(+), 28 deletions(-) create mode 100755 pkgs/by-name/sy/synology-drive-client/update.sh diff --git a/pkgs/by-name/sy/synology-drive-client/package.nix b/pkgs/by-name/sy/synology-drive-client/package.nix index 9991da0558a5..ebac377e719c 100644 --- a/pkgs/by-name/sy/synology-drive-client/package.nix +++ b/pkgs/by-name/sy/synology-drive-client/package.nix @@ -17,8 +17,8 @@ let pname = "synology-drive-client"; baseUrl = "https://global.synologydownload.com/download/Utility/SynologyDriveClient"; - version = "4.0.1-17885"; - buildNumber = lib.last (lib.splitString "-" version); + version = "4.0.2-17889"; + buildNumberFn = ver: lib.last (lib.splitString "-" ver); meta = { description = "Desktop application to synchronize files and folders between the computer and the Synology Drive server"; homepage = "https://www.synology.com/en-global/dsm/feature/drive"; @@ -36,34 +36,18 @@ let ]; mainProgram = "synology-drive"; }; - passthru.updateScript = writeScript "update-synology-drive-client" '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p curl jq common-updater-scripts + updateScript = ./update.sh; - set -eu -o pipefail - - version=$(curl -s "https://www.synology.com/api/releaseNote/findChangeLog?identify=SynologyDriveClient&lang=en-uk" \ - | jq -r '.info.versions | to_entries | .[0].value.all_versions[0].version') - - if [[ "$version" =~ ^[0-9.]+(-[0-9]+)?$ ]]; then - update-source-version synology-drive-client "$version" - else - echo "Error: Invalid version format: '$version'" - exit 1 - fi - ''; - - linux = stdenv.mkDerivation { + linux = stdenv.mkDerivation (finalAttrs: { inherit pname version meta - passthru ; src = fetchurl { - url = "${baseUrl}/${version}/Ubuntu/Installer/synology-drive-client-${buildNumber}.x86_64.deb"; - sha256 = "sha256-DMHqh8o0RknWTycANSbMpJj133/MZ8uZ18ytDZVaKMg="; + url = "${baseUrl}/${finalAttrs.version}/Ubuntu/Installer/synology-drive-client-${buildNumberFn finalAttrs.version}.x86_64.deb"; + sha256 = "sha256-refsAzqYmKAr107D4HiJViBQE1Qa6QoOECtX+TPjSwU="; }; nativeBuildInputs = [ @@ -99,19 +83,20 @@ let postInstall = '' substituteInPlace $out/bin/synology-drive --replace /opt $out/opt ''; - }; - darwin = stdenv.mkDerivation { + passthru = { inherit updateScript; }; + }); + + darwin = stdenv.mkDerivation (finalAttrs: { inherit pname version meta - passthru ; src = fetchurl { - url = "${baseUrl}/${version}/Mac/Installer/synology-drive-client-${buildNumber}.dmg"; - sha256 = "sha256-0rK7w4/RCv4qml+8XYPwLQmxHen3pB793Co4DvnDVuU="; + url = "${baseUrl}/${finalAttrs.version}/Mac/Installer/synology-drive-client-${buildNumberFn finalAttrs.version}.dmg"; + sha256 = "sha256-KAoc31Y2RTHu7RWgC61brtoeFR1c+pNi4Odub2JHrfQ="; }; nativeBuildInputs = [ @@ -132,6 +117,8 @@ let mkdir -p $out/Applications/ cp -R 'Synology Drive Client.app' $out/Applications/ ''; - }; + + passthru = { inherit updateScript; }; + }); in if stdenv.hostPlatform.isDarwin then darwin else linux diff --git a/pkgs/by-name/sy/synology-drive-client/update.sh b/pkgs/by-name/sy/synology-drive-client/update.sh new file mode 100755 index 000000000000..a72dfbed866e --- /dev/null +++ b/pkgs/by-name/sy/synology-drive-client/update.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq common-updater-scripts + +set -euo pipefail + +version=$(curl -s "https://www.synology.com/api/releaseNote/findChangeLog?identify=SynologyDriveClient&lang=en-uk" | jq -r '.info.versions | to_entries[0].value.all_versions[0].version') +build="${version##*-}" + +update_hash() { + local system=$1 + if [[ "$system" == *"linux"* ]]; then + url="https://global.synologydownload.com/download/Utility/SynologyDriveClient/$version/Ubuntu/Installer/synology-drive-client-$build.x86_64.deb" + else + url="https://global.synologydownload.com/download/Utility/SynologyDriveClient/$version/Mac/Installer/synology-drive-client-$build.dmg" + fi + + hash=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$url")) + update-source-version synology-drive-client "$version" "$hash" --system="$system" --ignore-same-version +} + +update_hash x86_64-linux +update_hash aarch64-darwin