2018-12-18 16:27:21 +00:00
|
|
|
{ stdenv, lib, fetchurl
|
|
|
|
, dpkg
|
|
|
|
, alsaLib
|
|
|
|
, at-spi2-atk
|
|
|
|
, at-spi2-core
|
|
|
|
, atk
|
|
|
|
, cairo
|
|
|
|
, cups
|
|
|
|
, dbus
|
|
|
|
, expat
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
2019-05-22 12:03:39 +01:00
|
|
|
, gdk-pixbuf
|
2018-12-18 16:27:21 +00:00
|
|
|
, glib
|
|
|
|
, gnome2
|
|
|
|
, gnome3
|
2019-06-12 18:07:47 +01:00
|
|
|
, gsettings-desktop-schemas
|
2018-12-18 16:27:21 +00:00
|
|
|
, gtk3
|
2019-07-05 09:54:33 +01:00
|
|
|
, libpulseaudio
|
2018-12-18 16:27:21 +00:00
|
|
|
, libuuid
|
2020-05-08 17:16:17 +01: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
|
|
|
|
, libXtst
|
2020-05-08 17:16:17 +01:00
|
|
|
, mesa
|
2018-12-18 16:27:21 +00:00
|
|
|
, nspr
|
|
|
|
, nss
|
|
|
|
, pango
|
|
|
|
, udev
|
|
|
|
, xorg
|
|
|
|
, zlib
|
|
|
|
, xdg_utils
|
|
|
|
, wrapGAppsHook
|
2018-10-04 12:52:14 +01:00
|
|
|
}:
|
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
rpath = lib.makeLibraryPath [
|
|
|
|
alsaLib
|
|
|
|
at-spi2-atk
|
|
|
|
at-spi2-core
|
|
|
|
atk
|
|
|
|
cairo
|
|
|
|
cups
|
|
|
|
dbus
|
|
|
|
expat
|
|
|
|
fontconfig
|
|
|
|
freetype
|
2019-05-22 12:03:39 +01:00
|
|
|
gdk-pixbuf
|
2019-06-12 18:07:47 +01:00
|
|
|
glib
|
|
|
|
gnome2.GConf
|
|
|
|
gtk3
|
2020-05-08 17:16:17 +01:00
|
|
|
libdrm
|
2019-07-05 09:54:33 +01:00
|
|
|
libpulseaudio
|
2019-06-12 18:07:47 +01:00
|
|
|
libX11
|
2020-11-29 00:29:31 +00:00
|
|
|
libxkbcommon
|
2019-06-12 18:07:47 +01:00
|
|
|
libXScrnSaver
|
|
|
|
libXcomposite
|
|
|
|
libXcursor
|
|
|
|
libXdamage
|
|
|
|
libXext
|
|
|
|
libXfixes
|
|
|
|
libXi
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
libXtst
|
|
|
|
libuuid
|
2020-05-08 17:16:17 +01:00
|
|
|
mesa
|
2019-06-12 18:07:47 +01:00
|
|
|
nspr
|
|
|
|
nss
|
|
|
|
pango
|
|
|
|
udev
|
|
|
|
xdg_utils
|
|
|
|
xorg.libxcb
|
|
|
|
zlib
|
2018-10-04 12:52:14 +01:00
|
|
|
];
|
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
in
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "brave";
|
2020-12-31 10:10:14 +00:00
|
|
|
version = "1.18.77";
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_amd64.deb";
|
2020-12-31 10:10:14 +00:00
|
|
|
sha256 = "AV3bqtWaoy6AVnt8K/Qo+7hguAIsPJPZhgLSeOvJ7JY=";
|
2019-06-12 18:07:47 +01:00
|
|
|
};
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
dontPatchELF = true;
|
2020-12-31 16:42:30 +00:00
|
|
|
doInstallCheck = true;
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
nativeBuildInputs = [ dpkg wrapGAppsHook ];
|
2018-11-22 08:09:09 +00:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
buildInputs = [ glib gsettings-desktop-schemas gnome3.adwaita-icon-theme ];
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner";
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out $out/bin
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
cp -R usr/share $out
|
|
|
|
cp -R opt/ $out/opt
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
export BINARYWRAPPER=$out/opt/brave.com/brave/brave-browser
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 18:07:47 +01: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 18:07:47 +01:00
|
|
|
ln -sf $BINARYWRAPPER $out/bin/brave
|
2018-10-04 12:52:14 +01:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath "${rpath}" $out/opt/brave.com/brave/brave
|
2018-11-03 12:01:27 +00:00
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
# Fix paths
|
|
|
|
substituteInPlace $out/share/applications/brave-browser.desktop \
|
2019-08-16 14:44:51 +01:00
|
|
|
--replace /usr/bin/brave-browser-stable $out/bin/brave
|
2019-06-12 18:07:47 +01: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 18:07:47 +01: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 18:07:47 +01: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 18:07:47 +01:00
|
|
|
# Replace xdg-settings and xdg-mime
|
|
|
|
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
|
|
|
|
'';
|
2018-10-04 12:52:14 +01: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;
|
|
|
|
|
2019-06-12 18:07:47 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "https://brave.com/";
|
|
|
|
description = "Privacy-oriented browser for Desktop and Laptop computers";
|
|
|
|
changelog = "https://github.com/brave/brave-browser/blob/v${version}/CHANGELOG.md";
|
|
|
|
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 18:07:47 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
2018-10-04 12:52:14 +01:00
|
|
|
}
|