nix/packages/cloudstation.nix

112 lines
2.6 KiB
Nix

{ stdenv
, autoPatchelfHook
, dbus_libs
, dpkg
, fetchurl
, fontconfig
, freetype
, glib
, libICE
, libSM
, xorg
, openssl_1_0_2
, openssl
, libX11
, makeWrapper
, sqlite
, wrapQtAppsHook
, xkeyboard_config
, zlib
, curl
}:
stdenv.mkDerivation rec {
name = "cloudstation";
version = "4.3.3";
release = "4469";
src = fetchurl {
url = "https://global.download.synology.com/download/Tools/CloudStationDrive/${version}-${release}/Ubuntu/Installer/x86_64/synology-cloud-station-drive-${release}.x86_64.deb";
sha256 = "0v84yb70knmmjzp7lyn6jgy5bnfsfd47wmqh29phybqg4zk3d47j";
};
nativeBuildInputs = [
dpkg
autoPatchelfHook
makeWrapper
wrapQtAppsHook
];
buildInputs = [
dbus_libs
fontconfig
freetype
glib
libICE
libSM
libX11
sqlite
stdenv.cc.cc.lib
zlib
openssl_1_0_2
xorg.libxcb
curl
];
ldpath = stdenv.lib.makeLibraryPath [
dbus_libs
fontconfig
freetype
glib
libICE
libSM
libX11
sqlite
stdenv.cc.cc.lib
zlib
openssl_1_0_2
openssl
xorg.libxcb
curl
];
unpackPhase = ''
dpkg-deb -x $src .
'';
installPhase = ''
mkdir -p $out/bin
cp -R opt $out
chmod +x $out/opt/Synology/CloudStation/lib/*
#ln -s $out/opt/Synology/CloudStation/bin/launcher $out/bin/cloudstation
makeWrapper \
$out/opt/Synology/CloudStation/bin/launcher \
$out/bin/cloudstation \
--set QT_PLUGIN_PATH $out/opt/Synology/CloudStationBackup/lib/plugins/platforms \
--set QT_XKB_CONFIG_ROOT ${xkeyboard_config}/share/X11/xkb \
--set LD_LIBRARY_PATH $out/opt/Synology/CloudStation/lib:${ldpath}
cat >> $out/bin/usercloudstation <<EOF
export QT_PLUGIN_PATH="$out/opt/Synology/CloudStationBackup/lib/plugins/platforms"
export QT_XKB_CONFIG_ROOT="${xkeyboard_config}/share/X11/xkb"
export LD_LIBRARY_PATH="~/.CloudStation/CloudStation.app/lib/:$out/opt/Synology/CloudStation/lib:${ldpath}"
bins="cloud-drive-auto-updater cloud-drive-connect cloud-drive-daemon cloud-drive-ui"
for file in $bins; do
nix-shell \
--command "autoPatchelf ~/.CloudStation/CloudStation.app/bin/$file" \
-p patchelf autoPatchelfHook
done
QT_QPA_PLATFORM=xcb exec /home/stefan/.CloudStation/CloudStation.app/bin/cloud-drive-ui
EOF
chmod +x $out/bin/usercloudstation
'';
meta = with stdenv.lib; {
homepage = "https://www.synology.com/de-de/support/download/RS815#utilities";
description = "Synology Cloud Station Drive";
platforms = platforms.linux;
maintainers = with maintainers; [ foosinn ];
};
}