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 276a5941b109e..20b2ef5aeecd2 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix @@ -10,7 +10,7 @@ let version = "1.4.9"; in -(libsForQt5.callPackage ../telegram-desktop/default.nix { +((libsForQt5.callPackage ../telegram-desktop/default.nix { inherit stdenv; tg_owt = (callPackage ../telegram-desktop/tg_owt.nix { @@ -39,9 +39,7 @@ in nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ yasm ]; }); - - withWebKitGTK = false; -}).overrideAttrs { +}).without-webkit.overrideAttrs { pname = "kotatogram-desktop"; version = "${version}-unstable-2024-09-27"; @@ -77,4 +75,4 @@ in maintainers = with maintainers; [ ilya-fedin ]; mainProgram = if stdenv.hostPlatform.isLinux then "kotatogram-desktop" else "Kotatogram"; }; -} +}).with-webkit 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 deleted file mode 100644 index f708b8a6246ea..0000000000000 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ stdenv, lib, kotatogram-desktop, glib-networking, webkitgtk_4_1, makeBinaryWrapper }: - -stdenv.mkDerivation { - pname = "${kotatogram-desktop.pname}-with-webkit"; - version = kotatogram-desktop.version; - nativeBuildInputs = [ makeBinaryWrapper ]; - dontUnpack = true; - installPhase = '' - mkdir -p $out - cp -r ${kotatogram-desktop}/share $out - substituteInPlace $out/share/dbus-1/services/* --replace-fail ${kotatogram-desktop} $out - ''; - postFixup = '' - mkdir -p $out/bin - makeBinaryWrapper {${kotatogram-desktop},$out}/bin/${kotatogram-desktop.meta.mainProgram} \ - --inherit-argv0 \ - --prefix GIO_EXTRA_MODULES : ${glib-networking}/lib/gio/modules \ - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ webkitgtk_4_1 ]} - ''; - meta = kotatogram-desktop.meta // { - platforms = lib.platforms.linux; - }; -} diff --git a/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/default.nix index 3f177b0fab175..a868a3d4ee1ae 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/default.nix @@ -32,10 +32,6 @@ , microsoft-gsl , boost , ada -, withWebKitGTK ? true -, wrapGAppsHook3 -, glib-networking -, webkitgtk_4_1 , libicns , apple-sdk_15 , nix-update-script @@ -48,7 +44,7 @@ # - https://git.alpinelinux.org/aports/tree/testing/telegram-desktop/APKBUILD # - https://github.com/void-linux/void-packages/blob/master/srcpkgs/telegram-desktop/template -stdenv.mkDerivation (finalAttrs: { +(stdenv.mkDerivation (finalAttrs: { pname = "telegram-desktop"; version = "5.6.3"; @@ -67,17 +63,11 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail '"libasound.so.2"' '"${alsa-lib}/lib/libasound.so.2"' substituteInPlace Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp \ --replace-fail '"libpulse.so.0"' '"${libpulseaudio}/lib/libpulse.so.0"' - '' + lib.optionalString (stdenv.hostPlatform.isLinux && withWebKitGTK) '' - substituteInPlace Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp \ - --replace-fail '"libwebkit2gtk-4.1.so.0"' '"${webkitgtk_4_1}/lib/libwebkit2gtk-4.1.so.0"' '' + lib.optionalString stdenv.hostPlatform.isDarwin '' substituteInPlace Telegram/lib_webrtc/webrtc/platform/mac/webrtc_environment_mac.mm \ --replace-fail kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster ''; - # Avoid double-wrapping - dontWrapGApps = true; - # Wrapping the inside of the app bundles, avoiding double-wrapping dontWrapQtApps = stdenv.hostPlatform.isDarwin; @@ -91,8 +81,6 @@ stdenv.mkDerivation (finalAttrs: { # to build bundled libdispatch clang gobject-introspection - ] ++ lib.optionals (stdenv.hostPlatform.isLinux && withWebKitGTK) [ - wrapGAppsHook3 ]; buildInputs = [ @@ -120,9 +108,6 @@ stdenv.mkDerivation (finalAttrs: { libpulseaudio hunspell jemalloc - ] ++ lib.optionals (stdenv.hostPlatform.isLinux && withWebKitGTK) [ - glib-networking - webkitgtk_4_1 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 libicns @@ -140,15 +125,15 @@ stdenv.mkDerivation (finalAttrs: { ln -s $out/{Applications/${finalAttrs.meta.mainProgram}.app/Contents/MacOS,bin} ''; - preFixup = lib.optionalString (stdenv.hostPlatform.isLinux && withWebKitGTK) '' - qtWrapperArgs+=("''${gappsWrapperArgs[@]}") - ''; - postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' wrapQtApp $out/Applications/${finalAttrs.meta.mainProgram}.app/Contents/MacOS/${finalAttrs.meta.mainProgram} ''; passthru = { + with-webkit = callPackage ./with-webkit.nix { + telegram-desktop = finalAttrs.finalPackage; + }; + without-webkit = finalAttrs.finalPackage; inherit tg_owt; updateScript = nix-update-script { }; }; @@ -166,4 +151,4 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with lib.maintainers; [ nickcao ]; mainProgram = if stdenv.hostPlatform.isLinux then "telegram-desktop" else "Telegram"; }; -}) +})).with-webkit diff --git a/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/with-webkit.nix b/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/with-webkit.nix new file mode 100644 index 0000000000000..0cd99956ee78d --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/with-webkit.nix @@ -0,0 +1,47 @@ +{ + stdenv, + lib, + telegram-desktop, + makeBinaryWrapper, + wrapGAppsHook3, + glib-networking, + webkitgtk_4_1, +}: + +if stdenv.hostPlatform.isLinux then + stdenv.mkDerivation { + pname = "${telegram-desktop.pname}-with-webkit"; + version = telegram-desktop.version; + nativeBuildInputs = telegram-desktop.nativeBuildInputs ++ [ + makeBinaryWrapper + wrapGAppsHook3 + ]; + buildInputs = telegram-desktop.buildInputs ++ [ + glib-networking + webkitgtk_4_1 + ]; + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + dontWrapGApps = true; + dontWrapQtApps = true; + installPhase = '' + mkdir -p $out + cp -r ${telegram-desktop}/share $out + substituteInPlace $out/share/dbus-1/services/* --replace-fail ${telegram-desktop} $out + ''; + postFixup = '' + mkdir -p $out/bin + makeBinaryWrapper ${telegram-desktop}/bin/.${telegram-desktop.meta.mainProgram}-wrapped $out/bin/${telegram-desktop.meta.mainProgram} \ + --inherit-argv0 \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ webkitgtk_4_1 ]} \ + ''${qtWrapperArgs[@]} \ + ''${gappsWrapperArgs[@]} + ''; + passthru = telegram-desktop.passthru; + meta = telegram-desktop.meta // { + platforms = lib.platforms.linux; + }; + } +else + telegram-desktop diff --git a/pkgs/by-name/_6/_64gram/package.nix b/pkgs/by-name/_6/_64gram/package.nix index 5681c03a92b44..c202beb0371d0 100644 --- a/pkgs/by-name/_6/_64gram/package.nix +++ b/pkgs/by-name/_6/_64gram/package.nix @@ -6,7 +6,7 @@ , nix-update-script }: -telegram-desktop.overrideAttrs (old: rec { +(telegram-desktop.without-webkit.overrideAttrs (old: rec { pname = "64gram"; version = "1.1.43"; @@ -32,7 +32,7 @@ telegram-desktop.overrideAttrs (old: rec { (lib.cmakeBool "disable_autoupdate" true) ]; - passthru.updateScript = nix-update-script {}; + passthru = (old.passthru or {}) // { updateScript = nix-update-script {}; }; meta = with lib; { description = "Unofficial Telegram Desktop providing Windows 64bit build and extra features"; @@ -43,4 +43,4 @@ telegram-desktop.overrideAttrs (old: rec { maintainers = with maintainers; [ clot27 ]; mainProgram = if stdenv.hostPlatform.isLinux then "telegram-desktop" else "Telegram"; }; -}) +})).with-webkit diff --git a/pkgs/by-name/ma/materialgram/package.nix b/pkgs/by-name/ma/materialgram/package.nix index 3ab41652a09c8..6adfd5e2404c8 100644 --- a/pkgs/by-name/ma/materialgram/package.nix +++ b/pkgs/by-name/ma/materialgram/package.nix @@ -3,7 +3,7 @@ lib, fetchFromGitHub, }: -telegram-desktop.overrideAttrs ( +(telegram-desktop.without-webkit.overrideAttrs ( finalAttrs: previousAttrs: { pname = "materialgram"; version = "5.6.1.1"; @@ -31,4 +31,4 @@ telegram-desktop.overrideAttrs ( mainProgram = "materialgram"; }; } -) +)).with-webkit diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 169919e3fc3a4..95087724273d9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30211,8 +30211,6 @@ with pkgs; kotatogram-desktop = callPackage ../applications/networking/instant-messengers/telegram/kotatogram-desktop { }; - kotatogram-desktop-with-webkit = callPackage ../applications/networking/instant-messengers/telegram/kotatogram-desktop/with-webkit.nix { }; - kpt = callPackage ../applications/networking/cluster/kpt { }; krabby = callPackage ../applications/misc/krabby { };