From 9b9eaf0208516f4f72ad64b2c6d8e672ccf480d1 Mon Sep 17 00:00:00 2001 From: "Miao, ZhiCheng" Date: Tue, 9 May 2023 00:54:45 +0300 Subject: [PATCH 1/3] insync: superceded by insync-v3 --- .../networking/insync/default.nix | 75 ++++++++++++++----- pkgs/top-level/all-packages.nix | 2 - 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/pkgs/applications/networking/insync/default.nix b/pkgs/applications/networking/insync/default.nix index 0c96262fff67..933d2288069a 100644 --- a/pkgs/applications/networking/insync/default.nix +++ b/pkgs/applications/networking/insync/default.nix @@ -1,34 +1,73 @@ -{ lib, stdenv, fetchurl, makeWrapper, autoPatchelfHook }: +{ stdenv +, lib +, fetchurl +, makeWrapper +, dpkg +, libxcb +, libGL +, nss +, libthai +, wayland +, alsa-lib +, qtvirtualkeyboard +, qtwebchannel +, qtwebsockets +, qtlocation +, qtwebengine +, autoPatchelfHook +, wrapQtAppsHook +}: stdenv.mkDerivation rec { pname = "insync"; - version = "1.5.7.37371"; - src = - if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl { - url = "http://s.insynchq.com/builds/insync-portable_${version}_amd64.tar.bz2"; - sha256 = "1cm3q6y2crw6pcsvh21sbkmh1hin7xl4fyslc96nbyql8rxsky5n"; - } - else - throw "${pname}-${version} is not supported on ${stdenv.hostPlatform.system}"; + version = "3.3.5.40925"; - nativeBuildInputs = [ makeWrapper autoPatchelfHook ]; + src = fetchurl { + url = "http://s.insynchq.com/builds/${pname}_${version}-focal_amd64.deb"; + sha256 = "sha256-lYlG/8d7teX98F5eDxm4EdBfFs7Sz3Td4kKLC6KZqnQ="; + }; postPatch = '' - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" client/insync-portable + substituteInPlace usr/bin/insync --replace /usr/lib/insync $out/usr/lib/insync + ''; + + buildInputs = [ + alsa-lib + libGL + libthai + libxcb + nss + qtlocation + qtvirtualkeyboard + qtwebchannel + qtwebengine + qtwebsockets + wayland + ]; + + nativeBuildInputs = [ autoPatchelfHook dpkg makeWrapper wrapQtAppsHook ]; + + unpackPhase = '' + dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner ''; installPhase = '' - mkdir -p $out/bin - cp -a client $out/client - makeWrapper $out/client/insync-portable $out/bin/insync --set LC_TIME C + mkdir -p $out/bin $out/lib $out/share + cp -R usr/* $out/ + rm $out/lib/insync/libGLX.so.0 + rm $out/lib/insync/libQt5* + sed -i 's|/usr/lib/insync|/lib/insync|' "$out/bin/insync" + wrapQtApp "$out/lib/insync/insync" ''; - meta = { + dontConfigure = true; + dontBuild = true; + + meta = with lib; { platforms = ["x86_64-linux"]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = lib.licenses.unfree; - maintainers = [ ]; + license = licenses.unfree; + maintainers = with maintainers; [ ]; homepage = "https://www.insynchq.com"; description = "Google Drive sync and backup with multiple account support"; longDescription = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 33dc02ea20ce..abd3cf711ffe 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33891,8 +33891,6 @@ with pkgs; insync = callPackage ../applications/networking/insync { }; - insync-v3 = libsForQt5.callPackage ../applications/networking/insync/v3.nix { }; - libstrangle = callPackage ../tools/X11/libstrangle { stdenv = stdenv_32bit; }; From 7a6a78c9700cf0205975ae07e0b04c2e3442fc8c Mon Sep 17 00:00:00 2001 From: "Miao, ZhiCheng" Date: Tue, 9 May 2023 00:54:59 +0300 Subject: [PATCH 2/3] insync-v3: remove insync-v3 has been merged into the insync package; use insync instead. --- pkgs/applications/networking/insync/v3.nix | 82 ---------------------- pkgs/top-level/aliases.nix | 1 + 2 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 pkgs/applications/networking/insync/v3.nix diff --git a/pkgs/applications/networking/insync/v3.nix b/pkgs/applications/networking/insync/v3.nix deleted file mode 100644 index b121b1c1ec5e..000000000000 --- a/pkgs/applications/networking/insync/v3.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ stdenv -, lib -, fetchurl -, makeWrapper -, dpkg -, libxcb -, libGL -, nss -, libthai -, wayland -, alsa-lib -, qtvirtualkeyboard -, qtwebchannel -, qtwebsockets -, qtlocation -, qtwebengine -, autoPatchelfHook -, wrapQtAppsHook -}: - -stdenv.mkDerivation rec { - pname = "insync"; - version = "3.8.5.50499"; - - src = fetchurl { - url = "https://cdn.insynchq.com/builds/linux/${pname}_${version}-focal_amd64.deb"; - hash = "sha256-CtDwU0Cey12kDjEX+Y9x7pfKNARfKDopWsDVRaA1Zts="; - }; - - postPatch = '' - substituteInPlace usr/bin/insync --replace /usr/lib/insync $out/usr/lib/insync - ''; - - buildInputs = [ - alsa-lib - libGL - libthai - libxcb - nss - qtlocation - qtvirtualkeyboard - qtwebchannel - qtwebengine - qtwebsockets - wayland - ]; - - nativeBuildInputs = [ autoPatchelfHook dpkg makeWrapper wrapQtAppsHook ]; - - unpackPhase = '' - dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner - ''; - - installPhase = '' - mkdir -p $out/bin $out/lib $out/share - cp -R usr/* $out/ - rm $out/lib/insync/libGLX.so.0 - rm $out/lib/insync/libQt5* - sed -i 's|/usr/lib/insync|/lib/insync|' "$out/bin/insync" - wrapQtApp "$out/lib/insync/insync" - ''; - - dontConfigure = true; - dontBuild = true; - - meta = with lib; { - platforms = ["x86_64-linux"]; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = licenses.unfree; - maintainers = with maintainers; [ ]; - homepage = "https://www.insynchq.com"; - description = "Google Drive sync and backup with multiple account support"; - longDescription = '' - Insync is a commercial application that syncs your Drive files to your - computer. It has more advanced features than Google's official client - such as multiple account support, Google Doc conversion, symlink support, - and built in sharing. - - There is a 15-day free trial, and it is a paid application after that. - ''; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index ad5ee363d675..057b2579835a 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -714,6 +714,7 @@ mapAliases ({ imagemagick7_light = imagemagick_light; # Added 2021-02-22 imlib = throw "imlib has been dropped due to the lack of maintenance from upstream since 2004"; # Added 2023-01-04 impressive = throw "impressive has been removed due to lack of released python 2 support and maintainership in nixpkgs"; # Added 2022-01-27 + insync-v3 = throw "insync-v3 has been merged into the insync package; use insync instead"; #Added 2023-05-13 i-score = throw "i-score has been removed: abandoned upstream"; # Added 2020-11-21 inboxer = throw "inboxer has been removed as it is no longer maintained and no longer works as Google shut down the inbox service this package wrapped"; index-fm = libsForQt5.mauiPackages.index; # added 2022-05-17 From 11b967964222e17ea69e33bab13d1bba7156d7bc Mon Sep 17 00:00:00 2001 From: "Miao, ZhiCheng" Date: Tue, 9 May 2023 00:56:01 +0300 Subject: [PATCH 3/3] insync: 3.3.5.40925 -> 3.8.5.50499 - Simplified packaging process: - Use as much vendor provided binaries as possible. - Only replace glibc with system provided ones (2.36+ required, hence nixos 22.11 is out). - Use buildFHSEnv to create FHS environment to run insync in. Known bug(s): 1) Currently the system try icon does not render correctly. 2) libqtvirtualkeyboardplugin does not have necessary Qt library shipped from vendor. --- .../networking/insync/default.nix | 152 ++++++++++-------- 1 file changed, 89 insertions(+), 63 deletions(-) diff --git a/pkgs/applications/networking/insync/default.nix b/pkgs/applications/networking/insync/default.nix index 933d2288069a..6269502ba87d 100644 --- a/pkgs/applications/networking/insync/default.nix +++ b/pkgs/applications/networking/insync/default.nix @@ -1,73 +1,26 @@ -{ stdenv -, lib +{ lib +, writeShellScript +, buildFHSEnv +, stdenv , fetchurl -, makeWrapper -, dpkg -, libxcb -, libGL -, nss -, libthai -, wayland -, alsa-lib -, qtvirtualkeyboard -, qtwebchannel -, qtwebsockets -, qtlocation -, qtwebengine , autoPatchelfHook -, wrapQtAppsHook +, dpkg +, nss +, libvorbis +, libdrm +, libGL +, wayland +, libthai }: -stdenv.mkDerivation rec { +let pname = "insync"; - version = "3.3.5.40925"; - - src = fetchurl { - url = "http://s.insynchq.com/builds/${pname}_${version}-focal_amd64.deb"; - sha256 = "sha256-lYlG/8d7teX98F5eDxm4EdBfFs7Sz3Td4kKLC6KZqnQ="; - }; - - postPatch = '' - substituteInPlace usr/bin/insync --replace /usr/lib/insync $out/usr/lib/insync - ''; - - buildInputs = [ - alsa-lib - libGL - libthai - libxcb - nss - qtlocation - qtvirtualkeyboard - qtwebchannel - qtwebengine - qtwebsockets - wayland - ]; - - nativeBuildInputs = [ autoPatchelfHook dpkg makeWrapper wrapQtAppsHook ]; - - unpackPhase = '' - dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner - ''; - - installPhase = '' - mkdir -p $out/bin $out/lib $out/share - cp -R usr/* $out/ - rm $out/lib/insync/libGLX.so.0 - rm $out/lib/insync/libQt5* - sed -i 's|/usr/lib/insync|/lib/insync|' "$out/bin/insync" - wrapQtApp "$out/lib/insync/insync" - ''; - - dontConfigure = true; - dontBuild = true; - + version = "3.8.5.50499"; meta = with lib; { platforms = ["x86_64-linux"]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ hellwolf ]; homepage = "https://www.insynchq.com"; description = "Google Drive sync and backup with multiple account support"; longDescription = '' @@ -77,8 +30,81 @@ stdenv.mkDerivation rec { and built in sharing. There is a 15-day free trial, and it is a paid application after that. + + Known bug(s): + + 1) Currently the system try icon does not render correctly. + 2) libqtvirtualkeyboardplugin does not have necessary Qt library shipped from vendor. ''; - # download URL removed - broken = true; }; + insync-pkg = stdenv.mkDerivation { + inherit pname version; + + src = fetchurl { + # Find a binary from https://www.insynchq.com/downloads/linux#ubuntu. + url = "https://cdn.insynchq.com/builds/linux/${pname}_${version}-lunar_amd64.deb"; + sha256 = "sha256-mpMJe8LAmO9OrqRIEWuxfVNeh5ANvjZIEHFz8cXYObY="; + }; + + buildInputs = [ + nss + libvorbis + libdrm + libGL + wayland + libthai + ]; + + nativeBuildInputs = [ autoPatchelfHook dpkg ]; + + unpackPhase = '' + dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin $out/lib $out/share + cp -R usr/* $out/ + + # use system glibc + rm -f $out/lib/insync/{libgcc_s.so.1,libstdc++.so.6} + + # remove badly packaged plugins + rm $out/lib/insync/PySide2/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so + + runHook postInstall + ''; + + dontConfigure = true; + dontBuild = true; + + # NB! This did the trick, otherwise it segfaults! However I don't understand why! + dontStrip = true; + + inherit meta; + }; +in buildFHSEnv { # ref: pkgs/build-support/build-fhsenv-bubblewrap/default.nix + name = "${pname}-${version}"; + inherit meta; + + # for including insync's xdg data dirs + extraOutputsToInstall = [ "share" ]; + + targetPkgs = pkgs: [ + insync-pkg + ]; + + multiPkgs = pkgs: with pkgs; [ + # apparently only package needed for the FHS :) + libudev0-shim + ]; + + runScript = writeShellScript "insync-wrapper.sh" '' + # QT_STYLE_OVERRIDE was used to suppress a QT warning, it should have no actual effect for this binary. + export QT_STYLE_OVERRIDE=Fusion + exec "${insync-pkg.outPath}/lib/insync/insync" "$@" + ''; + # "insync start" command starts a daemon. + dieWithParent = false; }