insync: bugfix of 3.8.6.50504

other changes:

- moved under pkgs/by-name/
- applied a hugly workaround to the start command's deamon crashing issue in the fhs wrapper.
This commit is contained in:
Miao, ZhiCheng 2023-12-31 09:31:52 +02:00 committed by hellwolf
parent 55cb8b04af
commit c83f685cfa
No known key found for this signature in database
GPG Key ID: 1080B4863AD0F5D1
2 changed files with 27 additions and 32 deletions

View File

@ -1,22 +1,27 @@
{ lib
, writeShellScript
, buildFHSEnvBubblewrap
, buildFHSEnv
, stdenvNoCC
, fetchurl
, autoPatchelfHook
, dpkg
, nss
, cacert
, alsa-lib
, libvorbis
, libdrm
, libGL
, wayland
, xkeyboard_config
, libthai
, libsForQt5
}:
let
pname = "insync";
# Find a binary from https://www.insynchq.com/downloads/linux#ubuntu.
version = "3.8.6.50504";
ubuntu-dist = "mantic_amd64";
meta = with lib; {
platforms = ["x86_64-linux"];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
@ -35,7 +40,6 @@ let
Known bug(s):
1) Currently the system try icon does not render correctly.
2) libqtvirtualkeyboardplugin does not have necessary Qt library shipped from vendor.
'';
mainProgram = "insync";
};
@ -45,22 +49,27 @@ let
inherit version meta;
src = fetchurl {
# Find a binary from https://www.insynchq.com/downloads/linux#ubuntu.
url = "https://cdn.insynchq.com/builds/linux/insync_${version}-lunar_amd64.deb";
sha256 = "sha256-BxTFtQ1rAsOuhKnH5vsl3zkM7WOd+vjA4LKZGxl4jk0=";
url = "https://cdn.insynchq.com/builds/linux/insync_${version}-${ubuntu-dist}.deb";
sha256 = "sha256-QfSfTJjMTWShQETlUQqXQTYT7mBNhmj0HHoT5bjF0o8=";
};
nativeBuildInputs = [
dpkg
autoPatchelfHook
libsForQt5.qt5.wrapQtAppsHook
];
buildInputs = [
nss
alsa-lib
libvorbis
libdrm
libGL
wayland
libthai
libsForQt5.qt5.qtvirtualkeyboard
];
nativeBuildInputs = [ autoPatchelfHook dpkg ];
unpackPhase = ''
dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner
'';
@ -71,15 +80,6 @@ let
mkdir -p $out
cp -R usr/* $out/
# use system glibc
rm $out/lib/insync/{libgcc_s.so.1,libstdc++.so.6}
# remove badly packaged plugins
rm $out/lib/insync/PySide2/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so
# remove the unused vendor wrapper
rm $out/bin/insync
runHook postInstall
'';
@ -87,31 +87,28 @@ let
dontStrip = true;
};
in buildFHSEnvBubblewrap {
in buildFHSEnv {
name = pname;
inherit meta;
targetPkgs = pkgs: with pkgs; [
insync-pkg
cacert
libudev0-shim
insync-pkg
];
runScript = writeShellScript "insync-wrapper.sh" ''
# QT_STYLE_OVERRIDE was used to suppress a QT warning, it should have no actual effect for this binary.
echo Unsetting QT_STYLE_OVERRIDE=$QT_STYLE_OVERRIDE
echo Unsetting QT_QPA_PLATFORMTHEME=$QT_QPA_PLATFORMTHEME
unset QT_STYLE_OVERRIDE
unset QPA_PLATFORMTHEME
extraInstallCommands = ''
cp -rsHf "${insync-pkg}"/share $out
'';
runScript = writeShellScript "insync-wrapper.sh" ''
# xkb configuration needed: https://github.com/NixOS/nixpkgs/issues/236365
export XKB_CONFIG_ROOT=${xkeyboard_config}/share/X11/xkb/
echo XKB_CONFIG_ROOT=$XKB_CONFIG_ROOT
# For debuging:
# For debugging:
# export QT_DEBUG_PLUGINS=1
# find -L /usr/share -name "*insync*"
exec /usr/lib/insync/insync "$@"
QT_QPA_PLATFORMTHEME=hicolor QT_STYLE_OVERRIDE=hicolor LC_TIME=C exec /usr/lib/insync/insync "$@"
'';
# As intended by this bubble wrap, share as much namespaces as possible with user.
@ -121,6 +118,6 @@ in buildFHSEnvBubblewrap {
unshareNet = false;
unshareUts = false;
unshareCgroup = false;
# Since "insync start" command starts a daemon, this daemon should die with it.
dieWithParent = false;
dieWithParent = true;
}

View File

@ -34742,8 +34742,6 @@ with pkgs;
myfitnesspal = with python3Packages; toPythonApplication myfitnesspal;
insync = callPackage ../applications/networking/insync { };
lemurs = callPackage ../applications/display-managers/lemurs { };
libstrangle = callPackage ../tools/X11/libstrangle {