update cloudstation

This commit is contained in:
foosinn 2021-08-03 11:30:29 +02:00
parent b8c0044faa
commit f75cf9bfa9
2 changed files with 59 additions and 94 deletions

View file

@ -1,58 +1,51 @@
{ stdenv
, autoPatchelfHook
, dbus_libs
, dpkg
, buildFHSUserEnv
, fetchurl
, fontconfig
, freetype
, glib
, libICE
, libSM
, xorg
, openssl_1_0_2
, openssl
, libX11
, makeWrapper
, sqlite
, wrapQtAppsHook
, xkeyboard_config
, zlib
, curl
, lib
, pkgs
, writeScript
}:
stdenv.mkDerivation rec {
name = "cloudstation";
let
version = "4.3.3";
release = "4469";
cloudstation = stdenv.mkDerivation rec {
name = "cloudstation-unpack";
buildInputs = [
pkgs.dpkg
pkgs.qt5.qtbase
];
#nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
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";
};
unpackPhase = ''
dpkg-deb -x $src .
'';
installPhase = ''
mkdir -p $out/bin
cp -R opt/Synology/CloudStation/* $out/
ls -lah $out
chmod +x $out/lib/*
cp $out/lib/plugins/platforms/libqxcb.so $out/lib/plugins/
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";
# fix xcb plugin
echo -e "[Paths]\nPlugins = ${pkgs.qt5.qtbase.bin}/${pkgs.qt5.qtbase.qtPluginPrefix}" > $out/bin/qt.conf
'';
dontWrapQtApps = true;
#preFixup = ''
# wrapQtApp "$out/bin/launcher"
#'';
};
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 [
in buildFHSUserEnv {
name = "cloudstation";
targetPkgs = pkgs: with pkgs; with xorg; [
cloudstation
curl
dbus_libs
fontconfig
freetype
@ -60,53 +53,26 @@ stdenv.mkDerivation rec {
libICE
libSM
libX11
sqlite
stdenv.cc.cc.lib
zlib
openssl_1_0_2
libxcb
openssl
xorg.libxcb
curl
qt5.qtbase
qt5.qttools
qt5.qtwayland
qt5.qtx11extras
sqlite
stdenv.cc.cc.lib
xkeyboard_config
zlib
];
unpackPhase = ''
dpkg-deb -x $src .
runScript = writeScript "cloudstation" ''
#!/usr/bin/env bash
#export QT_PLUGIN_PATH="$QT_PLUGIN_PATH:${cloudstation}/lib/plugins/platforms"
export QT_PLUGIN_PATH="${pkgs.qt5.qtbase.bin}/${pkgs.qt5.qtbase.qtPluginPrefix}"
${cloudstation}/bin/launcher
export LD_LIBRARY_PATH="/home/stefan/.CloudStation/CloudStation.app/lib:$LD_LIBRARY_PATH"
~/.CloudStation/CloudStation.app/bin/cloud-drive-ui
type bash
'';
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 ];
};
}