diff --git a/pkgs/applications/networking/instant-messengers/wavebox/default.nix b/pkgs/applications/networking/instant-messengers/wavebox/default.nix index d1df9c108143..eb4a9de8425d 100644 --- a/pkgs/applications/networking/instant-messengers/wavebox/default.nix +++ b/pkgs/applications/networking/instant-messengers/wavebox/default.nix @@ -1,94 +1,247 @@ -{ alsa-lib -, autoPatchelfHook -, fetchurl -, gtk3 -, gtk4 -, libnotify -, copyDesktopItems -, makeDesktopItem -, makeWrapper -, mesa -, nss -, lib -, libdrm -, qt5 -, stdenv -, udev -, xdg-utils -, xorg +{ + lib, + stdenv, + patchelf, + makeWrapper, + fetchurl, + writeScript, + + # Libraries + glib, + fontconfig, + freetype, + pango, + cairo, + libX11, + libXi, + atk, + nss, + nspr, + libXcursor, + libXext, + libXfixes, + libXrender, + libXScrnSaver, + libXcomposite, + libxcb, + alsa-lib, + libXdamage, + libXtst, + libXrandr, + libxshmfence, + expat, + cups, + dbus, + gtk3, + gtk4, + gdk-pixbuf, + gcc-unwrapped, + at-spi2-atk, + at-spi2-core, + libkrb5, + libdrm, + libglvnd, + mesa, + libxkbcommon, + pipewire, + wayland, + + coreutils, + + # command line arguments which are always set e.g "--disable-gpu" + commandLineArgs ? "", + + systemd, + + # Loaded at runtime. + libexif, + pciutils, + + liberation_ttf, + curl, + util-linux, + xdg-utils, + wget, + flac, + harfbuzz, + icu, + libpng, + libopus, + snappy, + speechd, + bzip2, + libcap, + + # Necessary for USB audio devices. + pulseSupport ? true, + libpulseaudio, + + gsettings-desktop-schemas, + + # Allow video acceleration via VA-API to be disabled on systems where is doesn't + # work reliably (--enable-features=VaapiVideoDecoder) + libvaSupport ? true, + libva, + + # For Vulkan support (--enable-features=Vulkan) + addDriverRunpath, }: -stdenv.mkDerivation rec { +let + opusWithCustomModes = libopus.override { withCustomModes = true; }; + + deps = + [ + glib + fontconfig + freetype + pango + cairo + libX11 + libXi + atk + nss + nspr + libXcursor + libXext + libXfixes + libXrender + libXScrnSaver + libXcomposite + libxcb + alsa-lib + libXdamage + libXtst + libXrandr + libxshmfence + expat + cups + dbus + gdk-pixbuf + gcc-unwrapped.lib + systemd + libexif + pciutils + liberation_ttf + curl + util-linux + wget + flac + harfbuzz + icu + libpng + opusWithCustomModes + snappy + speechd + bzip2 + libcap + at-spi2-atk + at-spi2-core + libkrb5 + libdrm + libglvnd + mesa + coreutils + libxkbcommon + pipewire + wayland + ] + ++ lib.optional pulseSupport libpulseaudio + ++ lib.optional libvaSupport libva + ++ [ + gtk3 + gtk4 + ]; + +in +stdenv.mkDerivation (finalAttrs: { pname = "wavebox"; - version = "10.124.17-2"; + version = "10.127.10-2"; src = fetchurl { - url = "https://download.wavebox.app/stable/linux/tar/Wavebox_${version}.tar.gz"; - sha256 = "sha256-RS1/zs/rFWsj29BrT8Mb2IXgy9brBsQypxfvnd7pKl0="; + url = "https://download.wavebox.app/stable/linux/deb/amd64/wavebox_${finalAttrs.version}_amd64.deb"; + hash = "sha256-x095V2UhRJfPmmG+4/i7I9AnCU4WVrw0b71nEu73uew="; }; - # don't remove runtime deps - dontPatchELF = true; - # ignore optional Qt 6 shim - autoPatchelfIgnoreMissingDeps = [ "libQt6Widgets.so.6" "libQt6Gui.so.6" "libQt6Core.so.6" ]; - - nativeBuildInputs = [ autoPatchelfHook makeWrapper qt5.wrapQtAppsHook copyDesktopItems ]; - - buildInputs = with xorg; [ - libXdmcp - libXScrnSaver - libXtst - libxshmfence - libXdamage - ] ++ [ - alsa-lib + nativeBuildInputs = [ + patchelf + makeWrapper + ]; + buildInputs = [ + gsettings-desktop-schemas # needed for GSETTINGS_SCHEMAS_PATH + glib gtk3 - nss - libdrm - mesa - gtk4 - qt5.qtbase ]; - runtimeDependencies = [ (lib.getLib udev) libnotify gtk4 ]; + unpackPhase = '' + ar x $src + tar xf data.tar.xz + ''; - desktopItems = [ - (makeDesktopItem rec { - name = "Wavebox"; - exec = "wavebox"; - icon = "wavebox"; - desktopName = name; - genericName = name; - categories = [ "Network" "WebBrowser" ]; - }) - ]; + rpath = lib.makeLibraryPath deps + ":" + lib.makeSearchPathOutput "lib" "lib64" deps; installPhase = '' runHook preInstall - mkdir -p $out/bin $out/opt/wavebox - cp -r * $out/opt/wavebox + exe=$out/bin/wavebox - # provide icon for desktop item - mkdir -p $out/share/icons/hicolor/128x128/apps - ln -s $out/opt/wavebox/product_logo_128.png $out/share/icons/hicolor/128x128/apps/wavebox.png + mkdir -p $out/bin $out/share + + cp -a opt/* $out/share + cp -a usr/share/* $out/share + + + substituteInPlace $out/share/wavebox.io/wavebox/wavebox-launcher \ + --replace-fail 'CHROME_WRAPPER' 'WRAPPER' + substituteInPlace $out/share/applications/wavebox.desktop \ + --replace-fail /opt/wavebox.io/wavebox/wavebox-launcher $exe + substituteInPlace $out/share/menu/wavebox.menu \ + --replace-fail /opt $out/share \ + --replace-fail $out/share/wavebox.io/wavebox/wavebox $exe + + for icon_file in $out/share/wavebox.io/wavebox/product_logo_[0-9]*.png; do + num_and_suffix="''${icon_file##*logo_}" + icon_size="''${num_and_suffix%.*}" + logo_output_prefix="$out/share/icons/hicolor" + logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps" + mkdir -p "$logo_output_path" + mv "$icon_file" "$logo_output_path/wavebox.png" + done + + makeWrapper "$out/share/wavebox.io/wavebox/wavebox" "$exe" \ + --prefix LD_LIBRARY_PATH : "$rpath" \ + --prefix PATH : "${lib.makeBinPath deps}" \ + --suffix PATH : "${lib.makeBinPath [ xdg-utils ]}" \ + --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:${addDriverRunpath.driverLink}/share" \ + --set CHROME_WRAPPER "wavebox" \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ + --add-flags ${lib.escapeShellArg commandLineArgs} + + for elf in $out/share/wavebox.io/wavebox/{wavebox,chrome-sandbox,chrome_crashpad_handler}; do + patchelf --set-rpath $rpath $elf + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $elf + done runHook postInstall ''; - postFixup = '' - makeWrapper $out/opt/wavebox/wavebox-launcher $out/bin/wavebox \ - --prefix PATH : ${xdg-utils}/bin - ''; + passthru = { + updateScript = writeScript "update-wavebox.sh" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p nix-update curl jq - passthru.updateScript = ./update.sh; - - meta = with lib; { - description = "Wavebox messaging application"; - homepage = "https://wavebox.io"; - license = licenses.mpl20; - maintainers = with maintainers; [ rawkode ]; - platforms = [ "x86_64-linux" ]; - hydraPlatforms = [ ]; + version=$(curl "https://download.wavebox.app/stable/linux/latest.json" | jq --raw-output '.["urls"]["deb"] | match("https://download.wavebox.app/stable/linux/deb/amd64/wavebox_(.+)_amd64.deb").captures[0]["string"]') + nix-update wavebox --version "$version" + ''; }; -} + + meta = { + description = "Wavebox Productivity Browser"; + homepage = "https://wavebox.io"; + license = lib.licenses.unfree; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + maintainers = with lib.maintainers; [ flexiondotorg ]; + platforms = [ "x86_64-linux" ]; + mainProgram = "wavebox"; + }; +}) diff --git a/pkgs/applications/networking/instant-messengers/wavebox/update.sh b/pkgs/applications/networking/instant-messengers/wavebox/update.sh deleted file mode 100755 index 316f8bfbb7ec..000000000000 --- a/pkgs/applications/networking/instant-messengers/wavebox/update.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p nix-update curl jq - -version=$(curl "https://download.wavebox.app/stable/linux/latest.json" | jq --raw-output '.["urls"]["tar"] | match("https://download.wavebox.app/stable/linux/tar/Wavebox_(.+).tar.gz").captures[0]["string"]') -nix-update wavebox --version "$version" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b0701bea062c..27e024861831 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33719,7 +33719,7 @@ with pkgs; viber = callPackage ../applications/networking/instant-messengers/viber { }; - wavebox = libsForQt5.callPackage ../applications/networking/instant-messengers/wavebox { }; + wavebox = callPackage ../applications/networking/instant-messengers/wavebox { }; sonic-pi = libsForQt5.callPackage ../applications/audio/sonic-pi { };