2021-01-15 05:42:41 +00:00
|
|
|
{ lib, stdenv, patchelf, makeWrapper
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
# Linked dynamic libraries.
|
|
|
|
, glib, fontconfig, freetype, pango, cairo, libX11, libXi, atk, gconf, nss, nspr
|
2016-12-11 17:53:51 +00:00
|
|
|
, libXcursor, libXext, libXfixes, libXrender, libXScrnSaver, libXcomposite, libxcb
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib, libXdamage, libXtst, libXrandr, libxshmfence, expat, cups
|
2020-11-29 10:19:42 +00:00
|
|
|
, dbus, gtk3, gdk-pixbuf, gcc-unwrapped, at-spi2-atk, at-spi2-core
|
2021-03-14 16:11:48 +00:00
|
|
|
, libkrb5, libdrm, mesa
|
2020-09-05 07:22:31 +00:00
|
|
|
, libxkbcommon, wayland # ozone/wayland
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2020-06-17 12:32:34 +00:00
|
|
|
# Command line programs
|
|
|
|
, coreutils
|
|
|
|
|
2017-01-05 16:46:37 +00:00
|
|
|
# command line arguments which are always set e.g "--disable-gpu"
|
|
|
|
, commandLineArgs ? ""
|
|
|
|
|
2015-11-08 17:55:47 +00:00
|
|
|
# Will crash without.
|
2016-09-05 16:59:00 +00:00
|
|
|
, systemd
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
# Loaded at runtime.
|
2021-07-25 07:53:56 +00:00
|
|
|
, libexif, pciutils
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
# Additional dependencies according to other distros.
|
|
|
|
## Ubuntu
|
2021-02-01 08:05:09 +00:00
|
|
|
, liberation_ttf, curl, util-linux, xdg-utils, wget
|
2015-11-08 17:55:47 +00:00
|
|
|
## Arch Linux.
|
|
|
|
, flac, harfbuzz, icu, libpng, libopus, snappy, speechd
|
|
|
|
## Gentoo
|
|
|
|
, bzip2, libcap
|
|
|
|
|
|
|
|
# Which distribution channel to use.
|
|
|
|
, channel ? "stable"
|
|
|
|
|
|
|
|
# Necessary for USB audio devices.
|
|
|
|
, pulseSupport ? true, libpulseaudio ? null
|
|
|
|
|
2016-05-04 21:12:33 +00:00
|
|
|
# Only needed for getting information about upstream binaries
|
|
|
|
, chromium
|
2017-06-16 05:49:50 +00:00
|
|
|
|
2018-02-25 02:23:58 +00:00
|
|
|
, gsettings-desktop-schemas
|
2021-05-07 21:18:14 +00:00
|
|
|
, gnome
|
2021-03-11 20:24:47 +00:00
|
|
|
|
|
|
|
# For video acceleration via VA-API (--enable-features=VaapiVideoDecoder)
|
|
|
|
, libvaSupport ? true, libva
|
2021-03-12 17:50:36 +00:00
|
|
|
|
|
|
|
# For Vulkan support (--enable-features=Vulkan)
|
|
|
|
, vulkanSupport ? true, vulkan-loader
|
2015-11-08 17:55:47 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
with lib;
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
opusWithCustomModes = libopus.override {
|
|
|
|
withCustomModes = true;
|
|
|
|
};
|
|
|
|
|
2018-01-25 20:59:39 +00:00
|
|
|
version = chromium.upstream-info.version;
|
2017-06-16 05:49:50 +00:00
|
|
|
|
2016-04-14 16:53:13 +00:00
|
|
|
deps = [
|
|
|
|
glib fontconfig freetype pango cairo libX11 libXi atk gconf nss nspr
|
2016-12-11 17:53:51 +00:00
|
|
|
libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite libxcb
|
2021-06-10 02:57:09 +00:00
|
|
|
alsa-lib libXdamage libXtst libXrandr libxshmfence expat cups
|
2019-05-22 11:03:39 +00:00
|
|
|
dbus gdk-pixbuf gcc-unwrapped.lib
|
2016-09-05 16:59:00 +00:00
|
|
|
systemd
|
2021-07-25 07:53:56 +00:00
|
|
|
libexif pciutils
|
2021-02-01 08:05:09 +00:00
|
|
|
liberation_ttf curl util-linux xdg-utils wget
|
2016-04-14 16:53:13 +00:00
|
|
|
flac harfbuzz icu libpng opusWithCustomModes snappy speechd
|
2018-11-02 09:01:36 +00:00
|
|
|
bzip2 libcap at-spi2-atk at-spi2-core
|
2021-03-14 16:11:48 +00:00
|
|
|
libkrb5 libdrm mesa coreutils
|
2020-09-05 07:22:31 +00:00
|
|
|
libxkbcommon wayland
|
2017-04-15 13:35:42 +00:00
|
|
|
] ++ optional pulseSupport libpulseaudio
|
2021-03-11 20:24:47 +00:00
|
|
|
++ optional libvaSupport libva
|
2021-03-12 17:50:36 +00:00
|
|
|
++ optional vulkanSupport vulkan-loader
|
2020-11-29 10:19:42 +00:00
|
|
|
++ [ gtk3 ];
|
2016-12-27 16:21:56 +00:00
|
|
|
|
|
|
|
suffix = if channel != "stable" then "-" + channel else "";
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
in stdenv.mkDerivation {
|
2015-11-08 17:55:47 +00:00
|
|
|
inherit version;
|
|
|
|
|
2016-12-27 16:21:56 +00:00
|
|
|
name = "google-chrome${suffix}-${version}";
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2019-11-06 19:37:25 +00:00
|
|
|
src = chromium.chromeSrc;
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2018-09-27 21:28:19 +00:00
|
|
|
nativeBuildInputs = [ patchelf makeWrapper ];
|
2017-06-16 05:49:50 +00:00
|
|
|
buildInputs = [
|
|
|
|
# needed for GSETTINGS_SCHEMAS_PATH
|
2020-11-29 10:19:42 +00:00
|
|
|
gsettings-desktop-schemas glib gtk3
|
2017-06-16 05:49:50 +00:00
|
|
|
|
|
|
|
# needed for XDG_ICON_DIRS
|
2021-05-07 21:18:14 +00:00
|
|
|
gnome.adwaita-icon-theme
|
2017-06-16 05:49:50 +00:00
|
|
|
];
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
ar x $src
|
|
|
|
tar xf data.tar.xz
|
|
|
|
'';
|
|
|
|
|
2016-04-14 15:14:28 +00:00
|
|
|
rpath = makeLibraryPath deps + ":" + makeSearchPathOutput "lib" "lib64" deps;
|
2016-04-14 16:53:13 +00:00
|
|
|
binpath = makeBinPath deps;
|
|
|
|
|
2015-11-08 17:55:47 +00:00
|
|
|
installPhase = ''
|
2015-12-28 08:31:48 +00:00
|
|
|
case ${channel} in
|
|
|
|
beta) appname=chrome-beta dist=beta ;;
|
|
|
|
dev) appname=chrome-unstable dist=unstable ;;
|
|
|
|
*) appname=chrome dist=stable ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exe=$out/bin/google-chrome-$dist
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
mkdir -p $out/bin $out/share
|
|
|
|
|
|
|
|
cp -a opt/* $out/share
|
|
|
|
cp -a usr/share/* $out/share
|
|
|
|
|
2020-07-15 13:24:24 +00:00
|
|
|
# To fix --use-gl=egl:
|
|
|
|
test -e $out/share/google/$appname/libEGL.so
|
|
|
|
ln -s libEGL.so $out/share/google/$appname/libEGL.so.1
|
|
|
|
test -e $out/share/google/$appname/libGLESv2.so
|
|
|
|
ln -s libGLESv2.so $out/share/google/$appname/libGLESv2.so.2
|
|
|
|
|
2015-12-28 08:31:48 +00:00
|
|
|
substituteInPlace $out/share/applications/google-$appname.desktop \
|
|
|
|
--replace /usr/bin/google-chrome-$dist $exe
|
|
|
|
substituteInPlace $out/share/gnome-control-center/default-apps/google-$appname.xml \
|
|
|
|
--replace /opt/google/$appname/google-$appname $exe
|
|
|
|
substituteInPlace $out/share/menu/google-$appname.menu \
|
2015-11-08 17:55:47 +00:00
|
|
|
--replace /opt $out/share \
|
2020-04-16 11:31:59 +00:00
|
|
|
--replace $out/share/google/$appname/google-$appname $exe
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2020-08-21 18:39:05 +00:00
|
|
|
for icon_file in $out/share/google/chrome*/product_logo_[0-9]*.png; do
|
2015-11-08 17:55:47 +00:00
|
|
|
num_and_suffix="''${icon_file##*logo_}"
|
2020-08-21 18:39:05 +00:00
|
|
|
if [ $dist = "stable" ]; then
|
|
|
|
icon_size="''${num_and_suffix%.*}"
|
|
|
|
else
|
|
|
|
icon_size="''${num_and_suffix%_*}"
|
|
|
|
fi
|
2015-11-08 17:55:47 +00:00
|
|
|
logo_output_prefix="$out/share/icons/hicolor"
|
|
|
|
logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps"
|
|
|
|
mkdir -p "$logo_output_path"
|
2015-12-28 08:31:48 +00:00
|
|
|
mv "$icon_file" "$logo_output_path/google-$appname.png"
|
2015-11-08 17:55:47 +00:00
|
|
|
done
|
|
|
|
|
2018-03-06 13:00:14 +00:00
|
|
|
makeWrapper "$out/share/google/$appname/google-$appname" "$exe" \
|
|
|
|
--prefix LD_LIBRARY_PATH : "$rpath" \
|
|
|
|
--prefix PATH : "$binpath" \
|
|
|
|
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \
|
|
|
|
--add-flags ${escapeShellArg commandLineArgs}
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2021-04-30 12:51:18 +00:00
|
|
|
for elf in $out/share/google/$appname/{chrome,chrome-sandbox,crashpad_handler,nacl_helper}; do
|
2015-11-08 17:55:47 +00:00
|
|
|
patchelf --set-rpath $rpath $elf
|
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $elf
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A freeware web browser developed by Google";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.google.com/chrome/browser/";
|
2015-11-08 17:55:47 +00:00
|
|
|
license = licenses.unfree;
|
2020-11-27 15:44:59 +00:00
|
|
|
maintainers = with maintainers; [ primeos ];
|
2020-10-29 12:40:12 +00:00
|
|
|
# Note from primeos: By updating Chromium I also update Google Chrome and
|
|
|
|
# will try to merge PRs and respond to issues but I'm not actually using
|
2020-11-27 15:44:59 +00:00
|
|
|
# Google Chrome.
|
2017-12-06 06:21:53 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2021-04-27 17:21:53 +00:00
|
|
|
mainProgram =
|
|
|
|
if (channel == "dev") then "google-chrome-unstable"
|
|
|
|
else "google-chrome-${channel}";
|
2015-11-08 17:55:47 +00:00
|
|
|
};
|
|
|
|
}
|