Skip to content

Instantly share code, notes, and snippets.

@albertov
Created September 14, 2018 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertov/653a6214ee5711dc30936d601254591d to your computer and use it in GitHub Desktop.
Save albertov/653a6214ee5711dc30936d601254591d to your computer and use it in GitHub Desktop.
{ stdenv, fetchurl, libXcomposite, libXdamage, gobjectIntrospection, glib
, dbus, nss, nspr, libX11, libxcb, libXcursor, libXext, libXfixes
, libXi, libXrender, libXtst, libXScrnSaver, expat, cairo, libXrandr, zlib
, pango, alsaLib, atk, gtk3, at-spi2-atk, gdk_pixbuf, fontconfig, makeWrapper
}:
let
libPath = stdenv.lib.makeLibraryPath [
libXdamage
libXcomposite
gobjectIntrospection
glib
dbus
nss
nspr
libX11
libxcb
libXcursor
libXext
libXfixes
libXi
libXrender
libXtst
expat
libXScrnSaver
cairo
libXrandr
zlib
pango
alsaLib
atk
gtk3
at-spi2-atk
gdk_pixbuf
fontconfig
];
in stdenv.mkDerivation rec {
name = "brave-browser-${version}";
version = "latest";
src = fetchurl {
url = "https://laptop-updates.brave.com/latest/linux64";
sha256 = "009a31hqxyyhjmnqj6zq91wgz5rjlp1lpbciciclhdh6drkvmgsb";
};
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
buildInputs = [makeWrapper];
unpackPhase = "tar xf $src .";
installPhase = ''
mkdir -p $out/bin
cp -a brave-linux-x64/* $out/
wrapProgram $out/brave \
--set FONTCONFIG_PATH "${fontconfig.out}/etc/fonts/" \
--set FONTCONFIG_FILE "${fontconfig.out}/etc/fonts/fonts.conf"
cd $out/bin
ln -s ../brave .
'';
fixupPhase = ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
$out/.brave-wrapped
patchelf --set-rpath ${libPath} $out/.brave-wrapped
'';
meta = with stdenv.lib; {
description = "Brave browser";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment