2022-08-12 12:06:08 +00:00
|
|
|
{ stdenv, lib, writeScript, qt5, fetchurl, autoPatchelfHook, dpkg, glibc, cpio, xar, undmg, gtk3, pango, libxcb }:
|
2021-12-06 16:07:01 +00:00
|
|
|
let
|
|
|
|
pname = "synology-drive-client";
|
2024-04-21 15:54:59 +00:00
|
|
|
baseUrl = "https://global.synologydownload.com/download/Utility/SynologyDriveClient";
|
|
|
|
version = "3.5.0-16084";
|
2022-08-12 12:06:08 +00:00
|
|
|
buildNumber = with lib; last (splitString "-" version);
|
2021-12-06 16:07:01 +00:00
|
|
|
meta = with lib; {
|
|
|
|
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";
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2021-12-06 16:07:01 +00:00
|
|
|
license = licenses.unfree;
|
2022-01-22 01:22:15 +00:00
|
|
|
maintainers = with maintainers; [ jcouyang MoritzBoehme ];
|
2024-04-21 15:54:59 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "synology-drive";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
2022-08-12 12:06:08 +00:00
|
|
|
passthru.updateScript = writeScript "update-synology-drive-client" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
version="$(curl -s https://www.synology.com/en-uk/releaseNote/SynologyDriveClient \
|
|
|
|
| grep -oP '(?<=data-version=")(\d.){2}\d-\d{5}' \
|
|
|
|
| head -1)"
|
|
|
|
update-source-version synology-drive-client "$version"
|
|
|
|
'';
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
linux = qt5.mkDerivation {
|
2022-08-12 12:06:08 +00:00
|
|
|
inherit pname version meta passthru;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2024-04-21 15:54:59 +00:00
|
|
|
url = "${baseUrl}/${version}/Ubuntu/Installer/synology-drive-client-${buildNumber}.x86_64.deb";
|
|
|
|
sha256 = "sha256-Spl6DC+wf+JaXjwH2ecraySo1VtA+EiI3/TWw9UOSA8=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoPatchelfHook dpkg ];
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
buildInputs = [ glibc gtk3 pango libxcb ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
dpkg -x $src $out
|
|
|
|
rm -rf $out/usr/lib/nautilus
|
|
|
|
rm -rf $out/opt/Synology/SynologyDrive/package/cloudstation/icon-overlay
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cp -av $out/usr/* $out
|
|
|
|
rm -rf $out/usr
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace $out/bin/synology-drive --replace /opt $out/opt
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
darwin = stdenv.mkDerivation {
|
2022-08-12 12:06:08 +00:00
|
|
|
inherit pname version meta passthru;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-08-12 12:06:08 +00:00
|
|
|
url = "${baseUrl}/${version}/Mac/Installer/synology-drive-client-${buildNumber}.dmg";
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-NDYxUhWtAVUtpCf1WemqShZCFHGgLGwrkX6HldxOlH0=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cpio xar undmg ];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
xar -xf 'Install Synology Drive Client.pkg'
|
|
|
|
cd synology-drive.installer.pkg
|
|
|
|
gunzip -dc Payload | cpio -i
|
|
|
|
'';
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/Applications/
|
|
|
|
cp -R 'Synology Drive Client.app' $out/Applications/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in if stdenv.isDarwin then darwin else linux
|