Merge pull request #170655 from jaen/fix-brave-gpu-acceleration

brave: 1.37.116 -> 1.38.109 and fix VAAPI/Vulkan
This commit is contained in:
Sandro 2022-05-03 01:14:18 +02:00 committed by GitHub
commit ad739de03b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 ? ""
# Necessary for USB audio devices.
, pulseSupport ? stdenv.isLinux
, libpulseaudio
# 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;
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
];
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