From dc508e7f5af09a01abdb41cdf580cd151ade72f2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 10 Apr 2022 01:35:55 +0400 Subject: kotatogram-desktop-with-webkit: init This allows to get maximum from the dlopen-based code and install webkit dependency only when needed and without rebuilds Tested with https://t.me/ShopBot --- .../telegram/kotatogram-desktop/default.nix | 21 -------------------- .../telegram/kotatogram-desktop/with-webkit.nix | 23 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix (limited to 'pkgs') diff --git a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix index ce5dc0e266e..f46a918d3c6 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix @@ -7,7 +7,6 @@ , ninja , clang , python3 -, wrapGAppsHook , wrapQtAppsHook , removeReferencesTo , extra-cmake-modules @@ -27,7 +26,6 @@ , tl-expected , hunspell , glibmm -, webkitgtk , jemalloc , rnnoise , abseil-cpp @@ -65,7 +63,6 @@ , IOSurface , Metal , MetalKit -, withWebKit ? false }: with lib; @@ -113,9 +110,6 @@ stdenv.mkDerivation rec { --replace '"libasound.so.2"' '"${alsa-lib}/lib/libasound.so.2"' substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp \ --replace '"libpulse.so.0"' '"${libpulseaudio}/lib/libpulse.so.0"' - '' + optionalString (stdenv.isLinux && withWebKit) '' - substituteInPlace Telegram/lib_webview/webview/platform/linux/webview_linux_webkit_gtk.cpp \ - --replace '"libwebkit2gtk-4.0.so.37"' '"${webkitgtk}/lib/libwebkit2gtk-4.0.so.37"' '' + optionalString stdenv.isDarwin '' substituteInPlace Telegram/CMakeLists.txt \ --replace 'COMMAND iconutil' 'COMMAND png2icns' \ @@ -124,10 +118,6 @@ stdenv.mkDerivation rec { --replace "\''${appicon_path}" "\''${appicon_path}/icon_16x16.png \''${appicon_path}/icon_32x32.png \''${appicon_path}/icon_128x128.png \''${appicon_path}/icon_256x256.png \''${appicon_path}/icon_512x512.png" ''; - # We want to run wrapProgram manually (with additional parameters) - dontWrapGApps = stdenv.isLinux; - dontWrapQtApps = stdenv.isLinux && withWebKit; - nativeBuildInputs = [ pkg-config cmake @@ -139,8 +129,6 @@ stdenv.mkDerivation rec { # to build bundled libdispatch clang extra-cmake-modules - ] ++ optionals (stdenv.isLinux && withWebKit) [ - wrapGAppsHook ]; buildInputs = [ @@ -166,8 +154,6 @@ stdenv.mkDerivation rec { glibmm jemalloc wayland - ] ++ optionals (stdenv.isLinux && withWebKit) [ - webkitgtk ] ++ optionals stdenv.isDarwin [ Cocoa CoreFoundation @@ -225,13 +211,6 @@ stdenv.mkDerivation rec { remove-references-to -t ${tg_owt.dev} $out/bin/$binName ''; - postFixup = optionalString (stdenv.isLinux && withWebKit) '' - # We also use gappsWrapperArgs from wrapGAppsHook. - wrapProgram $out/bin/kotatogram-desktop \ - "''${gappsWrapperArgs[@]}" \ - "''${qtWrapperArgs[@]}" - ''; - passthru = { inherit tg_owt; }; diff --git a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix new file mode 100644 index 00000000000..435268cdf62 --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix @@ -0,0 +1,23 @@ +{ stdenv, lib, kotatogram-desktop, glib-networking, webkitgtk, makeWrapper }: + +with lib; + +stdenv.mkDerivation { + pname = "${kotatogram-desktop.pname}-with-webkit"; + version = kotatogram-desktop.version; + nativeBuildInputs = [ makeWrapper ]; + dontUnpack = true; + installPhase = '' + mkdir -p $out + cp -r ${kotatogram-desktop}/share $out + ''; + postFixup = '' + mkdir -p $out/bin + makeWrapper ${kotatogram-desktop}/bin/kotatogram-desktop $out/bin/kotatogram-desktop \ + --prefix GIO_EXTRA_MODULES : ${glib-networking}/lib/gio/modules \ + --prefix LD_LIBRARY_PATH : ${makeLibraryPath [ webkitgtk ]} + ''; + meta = kotatogram-desktop.meta // { + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b746e502f24..78aeb1257ec 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27058,6 +27058,8 @@ with pkgs; abseil-cpp = abseil-cpp_202111; }; + kotatogram-desktop-with-webkit = callPackage ../applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix {}; + kpt = callPackage ../applications/networking/cluster/kpt { }; krane = callPackage ../applications/networking/cluster/krane { }; -- cgit 1.4.1