1 { stdenv, lib, writeScript, qt5, fetchurl, autoPatchelfHook, dpkg, glibc, cpio, xar, undmg, gtk3, pango, libxcb }:
3 pname = "synology-drive-client";
4 baseUrl = "https://global.synologydownload.com/download/Utility/SynologyDriveClient";
5 version = "3.5.1-16101";
6 buildNumber = lib.last (lib.splitString "-" version);
8 description = "Desktop application to synchronize files and folders between the computer and the Synology Drive server";
9 homepage = "https://www.synology.com/en-global/dsm/feature/drive";
10 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
11 license = licenses.unfree;
12 maintainers = with maintainers; [ jcouyang MoritzBoehme ];
13 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
14 mainProgram = "synology-drive";
16 passthru.updateScript = writeScript "update-synology-drive-client" ''
17 #!/usr/bin/env nix-shell
18 #!nix-shell -i bash -p curl common-updater-scripts
22 version="$(curl -s https://www.synology.com/en-uk/releaseNote/SynologyDriveClient \
23 | grep -oP '(?<=data-version=")(\d.){2}\d-\d{5}' \
25 update-source-version synology-drive-client "$version"
28 linux = stdenv.mkDerivation {
29 inherit pname version meta passthru;
32 url = "${baseUrl}/${version}/Ubuntu/Installer/synology-drive-client-${buildNumber}.x86_64.deb";
33 sha256 = "sha256-VeS5bPcMM4JDCSH5GXkl4OgQjrPKaNDh5PfX28/zqaU=";
36 nativeBuildInputs = [ qt5.wrapQtAppsHook autoPatchelfHook dpkg ];
38 buildInputs = [ glibc gtk3 pango libxcb ];
43 rm -rf $out/usr/lib/nautilus
44 rm -rf $out/opt/Synology/SynologyDrive/package/cloudstation/icon-overlay
48 cp -av $out/usr/* $out
54 substituteInPlace $out/bin/synology-drive --replace /opt $out/opt
58 darwin = stdenv.mkDerivation {
59 inherit pname version meta passthru;
62 url = "${baseUrl}/${version}/Mac/Installer/synology-drive-client-${buildNumber}.dmg";
63 sha256 = "sha256-VyhROpQCeVHNxxYgPUZdAlng15aJ1/IYadz30FThlsw=";
66 nativeBuildInputs = [ cpio xar undmg ];
69 xar -xf 'Install Synology Drive Client.pkg'
70 cd synology-drive.installer.pkg
71 gunzip -dc Payload | cpio -i
77 mkdir -p $out/Applications/
78 cp -R 'Synology Drive Client.app' $out/Applications/
81 in if stdenv.hostPlatform.isDarwin then darwin else linux