diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2022-05-03 01:14:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 01:14:18 +0200 |
commit | ad739de03b60a584f6e0133c536b3c53fc55d792 (patch) | |
tree | b9c1315fed3753c03b9eb9df89d49e8753831d05 /pkgs | |
parent | 738d1454fe71b7392102769a820de8809996b383 (diff) | |
parent | 0c5dc9c01ac7b9ed14bb24670fb314332b83503e (diff) |
Merge pull request #170655 from jaen/fix-brave-gpu-acceleration
brave: 1.37.116 -> 1.38.109 and fix VAAPI/Vulkan
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/applications/networking/browsers/brave/default.nix | 117 |
1 files changed, 65 insertions, 52 deletions
diff --git a/pkgs/applications/networking/browsers/brave/default.nix b/pkgs/applications/networking/browsers/brave/default.nix index 5d6df5dac0dea..ed9f16066b0d5 100644 --- a/pkgs/applications/networking/browsers/brave/default.nix +++ b/pkgs/applications/networking/browsers/brave/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl +{ lib, stdenv, fetchurl, wrapGAppsHook , dpkg , alsa-lib , at-spi2-atk @@ -15,7 +15,6 @@ , gnome , gsettings-desktop-schemas , gtk3 -, libpulseaudio , libuuid , libdrm , libX11 @@ -41,63 +40,58 @@ , xorg , zlib , xdg-utils -, wrapGAppsHook +, snappy + +# command line arguments which are always set e.g "--disable-gpu" , commandLineArgs ? "" -}: -let +# Necessary for USB audio devices. +, pulseSupport ? stdenv.isLinux +, libpulseaudio -rpath = lib.makeLibraryPath [ - alsa-lib - at-spi2-atk - at-spi2-core - atk - cairo - cups - dbus - expat - fontconfig - freetype - gdk-pixbuf - glib - gtk3 - libdrm - libpulseaudio - libX11 - libxkbcommon - libXScrnSaver - libXcomposite - libXcursor - libXdamage - libXext - libXfixes - libXi - libXrandr - libXrender - libxshmfence - libXtst - libuuid - mesa - nspr - nss - pango - pipewire - udev - wayland - xdg-utils - xorg.libxcb - zlib -]; +# For video acceleration via VA-API (--enable-features=VaapiVideoDecoder,VaapiVideoEncoder) +, libvaSupport ? stdenv.isLinux +, libva +, enableVideoAcceleration ? libvaSupport +# For Vulkan support (--enable-features=Vulkan); disabled by default as it seems to break VA-API +, vulkanSupport ? false +, addOpenGLRunpath +, enableVulkan ? vulkanSupport +}: + +let + inherit (lib) optional optionals makeLibraryPath makeSearchPathOutput makeBinPath + optionalString strings escapeShellArg; + + deps = [ + alsa-lib at-spi2-atk at-spi2-core atk cairo cups dbus expat + fontconfig freetype gdk-pixbuf glib gtk3 libdrm libX11 + libxkbcommon libXScrnSaver libXcomposite libXcursor libXdamage + libXext libXfixes libXi libXrandr libXrender libxshmfence + libXtst libuuid mesa nspr nss pango pipewire udev wayland + xdg-utils xorg.libxcb zlib snappy + ] + ++ optional pulseSupport libpulseaudio + ++ optional libvaSupport libva; + + rpath = makeLibraryPath deps + ":" + makeSearchPathOutput "lib" "lib64" deps; + binpath = makeBinPath deps; + + enableFeatures = optionals enableVideoAcceleration [ "VaapiVideoDecoder" "VaapiVideoEncoder" ] + ++ optional enableVulkan "Vulkan"; + + # The feature disable is needed for VAAPI to work correctly: https://github.com/brave/brave-browser/issues/20935 + disableFeatures = optional enableVideoAcceleration "UseChromeOSDirectVideoDecoder"; in stdenv.mkDerivation rec { pname = "brave"; - version = "1.37.116"; + version = "1.38.109"; src = fetchurl { url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_amd64.deb"; - sha256 = "HoqmzUyYas5ho9S8ZeXHj+LuNspejuQ69B6HxuKXWtw="; + sha256 = "sha256-w/Wm8msW4etF6E1UDujLfixhxmKBcnB+uw/CMcj4jGI="; }; dontConfigure = true; @@ -107,7 +101,13 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ dpkg wrapGAppsHook ]; - buildInputs = [ glib gsettings-desktop-schemas gnome.adwaita-icon-theme ]; + buildInputs = [ + # needed for GSETTINGS_SCHEMAS_PATH + glib gsettings-desktop-schemas gtk3 + + # needed for XDG_ICON_DIRS + gnome.adwaita-icon-theme + ]; unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner"; @@ -161,8 +161,21 @@ stdenv.mkDerivation rec { preFixup = '' # Add command line args to wrapGApp. - gappsWrapperArgs+=(--add-flags ${lib.escapeShellArg commandLineArgs}) - gappsWrapperArgs+=(--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland}}") + gappsWrapperArgs+=( + --prefix LD_LIBRARY_PATH : ${rpath} + --prefix PATH : ${binpath} + ${optionalString (enableFeatures != []) '' + --add-flags "--enable-features=${strings.concatStringsSep "," enableFeatures}" + ''} + ${optionalString (disableFeatures != []) '' + --add-flags "--disable-features=${strings.concatStringsSep "," disableFeatures}" + ''} + --add-flags ${escapeShellArg commandLineArgs} + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland}}" + ${optionalString vulkanSupport '' + --prefix XDG_DATA_DIRS : "${addOpenGLRunpath.driverLink}/share" + ''} + ) ''; installCheckPhase = '' @@ -175,7 +188,7 @@ stdenv.mkDerivation rec { meta = with lib; { homepage = "https://brave.com/"; description = "Privacy-oriented browser for Desktop and Laptop computers"; - changelog = "https://github.com/brave/brave-browser/blob/master/CHANGELOG_DESKTOP.md#" + lib.replaceStrings [ "." ] [ "" ] version; + changelog = "https://github.com/brave/brave-browser/blob/master/CHANGELOG_DESKTOP.md#" + replaceStrings [ "." ] [ "" ] version; longDescription = '' Brave browser blocks the ads and trackers that slow you down, chew up your bandwidth, and invade your privacy. Brave lets you |