2018-12-18 16:27:21 +00:00
|
|
|
{ stdenv, lib, fetchurl
|
|
|
|
, dpkg
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2018-12-18 16:27:21 +00:00
|
|
|
, at-spi2-atk
|
|
|
|
, at-spi2-core
|
|
|
|
, atk
|
|
|
|
, cairo
|
|
|
|
, cups
|
|
|
|
, dbus
|
|
|
|
, expat
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
2019-05-22 11:03:39 +00:00
|
|
|
, gdk-pixbuf
|
2018-12-18 16:27:21 +00:00
|
|
|
, glib
|
2021-05-07 21:18:14 +00:00
|
|
|
, gnome
|
2019-06-12 17:07:47 +00:00
|
|
|
, gsettings-desktop-schemas
|
2018-12-18 16:27:21 +00:00
|
|
|
, gtk3
|
2019-07-05 08:54:33 +00:00
|
|
|
, libpulseaudio
|
2018-12-18 16:27:21 +00:00
|
|
|
, libuuid
|
2020-05-08 16:16:17 +00:00
|
|
|
, libdrm
|
2018-12-18 16:27:21 +00:00
|
|
|
, libX11
|
|
|
|
, libXcomposite
|
|
|
|
, libXcursor
|
|
|
|
, libXdamage
|
|
|
|
, libXext
|
|
|
|
, libXfixes
|
|
|
|
, libXi
|
2020-11-23 01:42:20 +00:00
|
|
|
, libxkbcommon
|
2018-12-18 16:27:21 +00:00
|
|
|
, libXrandr
|
|
|
|
, libXrender
|
|
|
|
, libXScrnSaver
|
2021-03-04 00:26:15 +00:00
|
|
|
, libxshmfence
|
2018-12-18 16:27:21 +00:00
|
|
|
, libXtst
|
2020-05-08 16:16:17 +00:00
|
|
|
, mesa
|
2018-12-18 16:27:21 +00:00
|
|
|
, nspr
|
|
|
|
, nss
|
|
|
|
, pango
|
2021-03-11 14:50:17 +00:00
|
|
|
, pipewire
|
2018-12-18 16:27:21 +00:00
|
|
|
, udev
|
2022-03-04 19:03:17 +00:00
|
|
|
, wayland
|
2018-12-18 16:27:21 +00:00
|
|
|
, xorg
|
|
|
|
, zlib
|
2021-02-01 08:05:09 +00:00
|
|
|
, xdg-utils
|
2018-12-18 16:27:21 +00:00
|
|
|
, wrapGAppsHook
|
2021-09-03 13:41:52 +00:00
|
|
|
, commandLineArgs ? ""
|
2018-10-04 11:52:14 +00:00
|
|
|
}:
|
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
rpath = lib.makeLibraryPath [
|
2021-06-10 02:57:09 +00:00
|
|
|
alsa-lib
|
2019-06-12 17:07:47 +00:00
|
|
|
at-spi2-atk
|
|
|
|
at-spi2-core
|
|
|
|
atk
|
|
|
|
cairo
|
|
|
|
cups
|
|
|
|
dbus
|
|
|
|
expat
|
|
|
|
fontconfig
|
|
|
|
freetype
|
2019-05-22 11:03:39 +00:00
|
|
|
gdk-pixbuf
|
2019-06-12 17:07:47 +00:00
|
|
|
glib
|
|
|
|
gtk3
|
2020-05-08 16:16:17 +00:00
|
|
|
libdrm
|
2019-07-05 08:54:33 +00:00
|
|
|
libpulseaudio
|
2019-06-12 17:07:47 +00:00
|
|
|
libX11
|
2020-11-29 00:29:31 +00:00
|
|
|
libxkbcommon
|
2019-06-12 17:07:47 +00:00
|
|
|
libXScrnSaver
|
|
|
|
libXcomposite
|
|
|
|
libXcursor
|
|
|
|
libXdamage
|
|
|
|
libXext
|
|
|
|
libXfixes
|
|
|
|
libXi
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
2021-03-04 00:26:15 +00:00
|
|
|
libxshmfence
|
2019-06-12 17:07:47 +00:00
|
|
|
libXtst
|
|
|
|
libuuid
|
2020-05-08 16:16:17 +00:00
|
|
|
mesa
|
2019-06-12 17:07:47 +00:00
|
|
|
nspr
|
|
|
|
nss
|
|
|
|
pango
|
2021-03-11 14:50:17 +00:00
|
|
|
pipewire
|
2019-06-12 17:07:47 +00:00
|
|
|
udev
|
2022-03-04 19:03:17 +00:00
|
|
|
wayland
|
2021-02-01 08:05:09 +00:00
|
|
|
xdg-utils
|
2019-06-12 17:07:47 +00:00
|
|
|
xorg.libxcb
|
|
|
|
zlib
|
2018-10-04 11:52:14 +00:00
|
|
|
];
|
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
in
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "brave";
|
2022-04-16 01:34:02 +00:00
|
|
|
version = "1.37.116";
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_amd64.deb";
|
2022-04-16 01:34:02 +00:00
|
|
|
sha256 = "HoqmzUyYas5ho9S8ZeXHj+LuNspejuQ69B6HxuKXWtw=";
|
2019-06-12 17:07:47 +00:00
|
|
|
};
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
dontPatchELF = true;
|
2020-12-31 16:42:30 +00:00
|
|
|
doInstallCheck = true;
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
nativeBuildInputs = [ dpkg wrapGAppsHook ];
|
2018-11-22 08:09:09 +00:00
|
|
|
|
2021-05-07 21:18:14 +00:00
|
|
|
buildInputs = [ glib gsettings-desktop-schemas gnome.adwaita-icon-theme ];
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner";
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
installPhase = ''
|
2021-05-06 08:01:48 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
mkdir -p $out $out/bin
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
cp -R usr/share $out
|
|
|
|
cp -R opt/ $out/opt
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
export BINARYWRAPPER=$out/opt/brave.com/brave/brave-browser
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
# Fix path to bash in $BINARYWRAPPER
|
|
|
|
substituteInPlace $BINARYWRAPPER \
|
|
|
|
--replace /bin/bash ${stdenv.shell}
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
ln -sf $BINARYWRAPPER $out/bin/brave
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2021-09-29 05:50:05 +00:00
|
|
|
for exe in $out/opt/brave.com/brave/{brave,chrome_crashpad_handler}; do
|
2019-06-12 17:07:47 +00:00
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
2021-07-28 17:48:19 +00:00
|
|
|
--set-rpath "${rpath}" $exe
|
|
|
|
done
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
# Fix paths
|
|
|
|
substituteInPlace $out/share/applications/brave-browser.desktop \
|
2019-08-16 13:44:51 +00:00
|
|
|
--replace /usr/bin/brave-browser-stable $out/bin/brave
|
2019-06-12 17:07:47 +00:00
|
|
|
substituteInPlace $out/share/gnome-control-center/default-apps/brave-browser.xml \
|
|
|
|
--replace /opt/brave.com $out/opt/brave.com
|
|
|
|
substituteInPlace $out/share/menu/brave-browser.menu \
|
|
|
|
--replace /opt/brave.com $out/opt/brave.com
|
|
|
|
substituteInPlace $out/opt/brave.com/brave/default-app-block \
|
|
|
|
--replace /opt/brave.com $out/opt/brave.com
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
# Correct icons location
|
|
|
|
icon_sizes=("16" "22" "24" "32" "48" "64" "128" "256")
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
for icon in ''${icon_sizes[*]}
|
|
|
|
do
|
|
|
|
mkdir -p $out/share/icons/hicolor/$icon\x$icon/apps
|
|
|
|
ln -s $out/opt/brave.com/brave/product_logo_$icon.png $out/share/icons/hicolor/$icon\x$icon/apps/brave-browser.png
|
|
|
|
done
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 17:07:47 +00:00
|
|
|
# Replace xdg-settings and xdg-mime
|
2021-02-01 08:05:09 +00:00
|
|
|
ln -sf ${xdg-utils}/bin/xdg-settings $out/opt/brave.com/brave/xdg-settings
|
|
|
|
ln -sf ${xdg-utils}/bin/xdg-mime $out/opt/brave.com/brave/xdg-mime
|
2021-05-06 08:01:48 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2019-06-12 17:07:47 +00:00
|
|
|
'';
|
2018-10-04 11:52:14 +00:00
|
|
|
|
2021-09-03 13:41:52 +00:00
|
|
|
preFixup = ''
|
|
|
|
# Add command line args to wrapGApp.
|
|
|
|
gappsWrapperArgs+=(--add-flags ${lib.escapeShellArg commandLineArgs})
|
2022-03-04 19:03:17 +00:00
|
|
|
gappsWrapperArgs+=(--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland}}")
|
2021-09-03 13:41:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-12-31 16:42:30 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
# Bypass upstream wrapper which suppresses errors
|
|
|
|
$out/opt/brave.com/brave/brave --version
|
|
|
|
'';
|
|
|
|
|
2020-12-31 10:06:53 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-06-12 17:07:47 +00:00
|
|
|
homepage = "https://brave.com/";
|
|
|
|
description = "Privacy-oriented browser for Desktop and Laptop computers";
|
2022-01-07 22:21:37 +00:00
|
|
|
changelog = "https://github.com/brave/brave-browser/blob/master/CHANGELOG_DESKTOP.md#" + lib.replaceStrings [ "." ] [ "" ] version;
|
2019-06-12 17:07:47 +00:00
|
|
|
longDescription = ''
|
|
|
|
Brave browser blocks the ads and trackers that slow you down,
|
|
|
|
chew up your bandwidth, and invade your privacy. Brave lets you
|
|
|
|
contribute to your favorite creators automatically.
|
|
|
|
'';
|
|
|
|
license = licenses.mpl20;
|
2020-12-01 14:22:52 +00:00
|
|
|
maintainers = with maintainers; [ uskudnik rht jefflabonte nasirhm ];
|
2019-06-12 17:07:47 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
2018-10-04 11:52:14 +00:00
|
|
|
}
|