2024-05-11 07:29:58 +01:00
|
|
|
{ lib, stdenv, patchelf, makeWrapper, fetchurl, writeScript
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
# Linked dynamic libraries.
|
2022-02-11 14:02:33 +00:00
|
|
|
, glib, fontconfig, freetype, pango, cairo, libX11, libXi, atk, nss, nspr
|
2016-12-11 17:53:51 +00:00
|
|
|
, libXcursor, libXext, libXfixes, libXrender, libXScrnSaver, libXcomposite, libxcb
|
2021-06-10 03:57:09 +01:00
|
|
|
, alsa-lib, libXdamage, libXtst, libXrandr, libxshmfence, expat, cups
|
2023-02-27 22:50:50 +00:00
|
|
|
, dbus, gtk3, gtk4, gdk-pixbuf, gcc-unwrapped, at-spi2-atk, at-spi2-core
|
2022-01-19 19:50:11 +00:00
|
|
|
, libkrb5, libdrm, libglvnd, mesa
|
2021-09-25 10:32:58 +01:00
|
|
|
, libxkbcommon, pipewire, wayland # ozone/wayland
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2020-06-17 13:32:34 +01: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 17:59:00 +01:00
|
|
|
, systemd
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
# Loaded at runtime.
|
2021-07-25 08:53:56 +01: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
|
|
|
|
|
|
|
|
# Necessary for USB audio devices.
|
2022-04-30 01:40:42 +01:00
|
|
|
, pulseSupport ? true, libpulseaudio
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2018-02-25 02:23:58 +00:00
|
|
|
, gsettings-desktop-schemas
|
2021-05-07 22:18:14 +01: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)
|
2022-01-18 08:16:04 +00:00
|
|
|
, addOpenGLRunpath
|
2015-11-08 17:55:47 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
opusWithCustomModes = libopus.override {
|
|
|
|
withCustomModes = true;
|
|
|
|
};
|
|
|
|
|
2016-04-14 17:53:13 +01:00
|
|
|
deps = [
|
2022-02-11 14:02:33 +00:00
|
|
|
glib fontconfig freetype pango cairo libX11 libXi atk nss nspr
|
2016-12-11 17:53:51 +00:00
|
|
|
libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite libxcb
|
2021-06-10 03:57:09 +01:00
|
|
|
alsa-lib libXdamage libXtst libXrandr libxshmfence expat cups
|
2019-05-22 12:03:39 +01:00
|
|
|
dbus gdk-pixbuf gcc-unwrapped.lib
|
2016-09-05 17:59:00 +01:00
|
|
|
systemd
|
2021-07-25 08:53:56 +01:00
|
|
|
libexif pciutils
|
2022-07-12 00:23:52 +01:00
|
|
|
liberation_ttf curl util-linux wget
|
2016-04-14 17:53:13 +01:00
|
|
|
flac harfbuzz icu libpng opusWithCustomModes snappy speechd
|
2018-11-02 09:01:36 +00:00
|
|
|
bzip2 libcap at-spi2-atk at-spi2-core
|
2022-01-19 19:50:11 +00:00
|
|
|
libkrb5 libdrm libglvnd mesa coreutils
|
2021-09-25 10:32:58 +01:00
|
|
|
libxkbcommon pipewire wayland
|
2023-01-24 16:29:20 +00:00
|
|
|
] ++ lib.optional pulseSupport libpulseaudio
|
|
|
|
++ lib.optional libvaSupport libva
|
2023-02-27 22:50:50 +00:00
|
|
|
++ [ gtk3 gtk4 ];
|
2016-12-27 16:21:56 +00:00
|
|
|
|
google-chrome: move independently of `chromium`
Historically, `google-chrome` used the version info and debian package
FOD provided by `chromium`.
This was very efficient, because `chromium` uses parts of the debian
tarball for Widevine (opt-in, via `.override`).
Meaning `chromium` has to track that debian tarball with each update
anyway.
And they always release in sync.
So why keep seperate `google-chrome` from `chromium` now?
- The current `chromium` maintainers are already at capacity
maintaining `chromium` and have no time for `google-chrome`.
- `chromium` bumps become sometimes a bottleneck for `google-chrome`.
This is because `chromium` is built from source and a lot more time
consuming and significantly more complex.
- Lately, `chromium` and `google-chrome` both had an upstream issue
under wayland with `--ozone-platform-hint`, rendering it unusable.
For `chromium` we were able to patch it, since unlike `google-chrome`
it's built from source.
The `chromium` maintainers simply forgot that `google-chrome` might
have the same issue, continued to merge the PR, rendering
`google-chrome` broken.
This PR also removes primeos from `meta.maintainers` since they only
added themself to `google-chrome` because it inherited `chromium`'s
version, stating they don't actually use `google-chrome`.
Furthermore, primeos no longer maintains `chromium`.
Ref 477e7d6b60e817661632ff3a8aaf2e39c4cceadc
2024-05-01 22:43:15 +01:00
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2024-05-01 22:37:27 +01:00
|
|
|
pname = "google-chrome";
|
2024-05-15 13:53:30 +01:00
|
|
|
version = "125.0.6422.60";
|
2015-11-08 17:55:47 +00:00
|
|
|
|
google-chrome: move independently of `chromium`
Historically, `google-chrome` used the version info and debian package
FOD provided by `chromium`.
This was very efficient, because `chromium` uses parts of the debian
tarball for Widevine (opt-in, via `.override`).
Meaning `chromium` has to track that debian tarball with each update
anyway.
And they always release in sync.
So why keep seperate `google-chrome` from `chromium` now?
- The current `chromium` maintainers are already at capacity
maintaining `chromium` and have no time for `google-chrome`.
- `chromium` bumps become sometimes a bottleneck for `google-chrome`.
This is because `chromium` is built from source and a lot more time
consuming and significantly more complex.
- Lately, `chromium` and `google-chrome` both had an upstream issue
under wayland with `--ozone-platform-hint`, rendering it unusable.
For `chromium` we were able to patch it, since unlike `google-chrome`
it's built from source.
The `chromium` maintainers simply forgot that `google-chrome` might
have the same issue, continued to merge the PR, rendering
`google-chrome` broken.
This PR also removes primeos from `meta.maintainers` since they only
added themself to `google-chrome` because it inherited `chromium`'s
version, stating they don't actually use `google-chrome`.
Furthermore, primeos no longer maintains `chromium`.
Ref 477e7d6b60e817661632ff3a8aaf2e39c4cceadc
2024-05-01 22:43:15 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${finalAttrs.version}-1_amd64.deb";
|
2024-05-15 13:53:30 +01:00
|
|
|
hash = "sha256-Q0QMPthJLVquJp7fm6QN+lDb0quZsT7hv6KRXfdBMl4=";
|
google-chrome: move independently of `chromium`
Historically, `google-chrome` used the version info and debian package
FOD provided by `chromium`.
This was very efficient, because `chromium` uses parts of the debian
tarball for Widevine (opt-in, via `.override`).
Meaning `chromium` has to track that debian tarball with each update
anyway.
And they always release in sync.
So why keep seperate `google-chrome` from `chromium` now?
- The current `chromium` maintainers are already at capacity
maintaining `chromium` and have no time for `google-chrome`.
- `chromium` bumps become sometimes a bottleneck for `google-chrome`.
This is because `chromium` is built from source and a lot more time
consuming and significantly more complex.
- Lately, `chromium` and `google-chrome` both had an upstream issue
under wayland with `--ozone-platform-hint`, rendering it unusable.
For `chromium` we were able to patch it, since unlike `google-chrome`
it's built from source.
The `chromium` maintainers simply forgot that `google-chrome` might
have the same issue, continued to merge the PR, rendering
`google-chrome` broken.
This PR also removes primeos from `meta.maintainers` since they only
added themself to `google-chrome` because it inherited `chromium`'s
version, stating they don't actually use `google-chrome`.
Furthermore, primeos no longer maintains `chromium`.
Ref 477e7d6b60e817661632ff3a8aaf2e39c4cceadc
2024-05-01 22:43:15 +01:00
|
|
|
};
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2018-09-27 22:28:19 +01:00
|
|
|
nativeBuildInputs = [ patchelf makeWrapper ];
|
2017-06-16 06:49:50 +01:00
|
|
|
buildInputs = [
|
|
|
|
# needed for GSETTINGS_SCHEMAS_PATH
|
2020-11-29 10:19:42 +00:00
|
|
|
gsettings-desktop-schemas glib gtk3
|
2017-06-16 06:49:50 +01:00
|
|
|
|
|
|
|
# needed for XDG_ICON_DIRS
|
2021-05-07 22:18:14 +01:00
|
|
|
gnome.adwaita-icon-theme
|
2017-06-16 06:49:50 +01:00
|
|
|
];
|
2015-11-08 17:55:47 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
ar x $src
|
|
|
|
tar xf data.tar.xz
|
|
|
|
'';
|
|
|
|
|
2023-01-24 16:29:20 +00:00
|
|
|
rpath = lib.makeLibraryPath deps + ":" + lib.makeSearchPathOutput "lib" "lib64" deps;
|
|
|
|
binpath = lib.makeBinPath deps;
|
2016-04-14 17:53:13 +01:00
|
|
|
|
2015-11-08 17:55:47 +00:00
|
|
|
installPhase = ''
|
2021-12-23 16:43:01 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2024-05-01 22:37:27 +01:00
|
|
|
appname=chrome
|
|
|
|
dist=stable
|
2015-12-28 08:31:48 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-01-17 23:15:18 +00:00
|
|
|
|
|
|
|
substituteInPlace $out/share/google/$appname/google-$appname \
|
|
|
|
--replace 'CHROME_WRAPPER' 'WRAPPER'
|
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 12:31:59 +01:00
|
|
|
--replace $out/share/google/$appname/google-$appname $exe
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2020-08-21 19:39:05 +01: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 19:39:05 +01: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" \
|
2022-07-12 00:23:52 +01:00
|
|
|
--suffix PATH : "${lib.makeBinPath [ xdg-utils ]}" \
|
2022-01-31 18:16:47 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:${addOpenGLRunpath.driverLink}/share" \
|
2022-01-17 23:15:18 +00:00
|
|
|
--set CHROME_WRAPPER "google-chrome-$dist" \
|
2022-09-23 20:19:37 +01:00
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
2023-01-24 16:29:20 +00:00
|
|
|
--add-flags ${lib.escapeShellArg commandLineArgs}
|
2015-11-08 17:55:47 +00:00
|
|
|
|
2024-05-01 22:37:27 +01:00
|
|
|
for elf in $out/share/google/$appname/{chrome,chrome-sandbox,chrome_crashpad_handler}; 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
|
2021-12-23 16:43:01 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2015-11-08 17:55:47 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-11 07:29:58 +01:00
|
|
|
passthru = {
|
|
|
|
updateScript = writeScript "update-google-chrome.sh" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
2024-05-15 12:47:11 +01:00
|
|
|
set -euo pipefail
|
2024-05-11 07:29:58 +01:00
|
|
|
url="https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions/all/releases"
|
2024-05-15 12:47:11 +01:00
|
|
|
response="$(curl --silent --fail $url)"
|
|
|
|
version="$(jq ".releases[0].version" --raw-output <<< $response)"
|
|
|
|
update-source-version ${finalAttrs.pname} $version --ignore-same-hash
|
2024-05-11 07:29:58 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-05-10 19:57:53 +01:00
|
|
|
meta = {
|
2015-11-08 17:55:47 +00:00
|
|
|
description = "A freeware web browser developed by Google";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.google.com/chrome/browser/";
|
2024-05-10 19:57:53 +01:00
|
|
|
license = lib.licenses.unfree;
|
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
|
|
maintainers = with lib.maintainers; [ jnsgruk johnrtitor ];
|
2017-12-06 06:21:53 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2024-05-01 22:37:27 +01:00
|
|
|
mainProgram = "google-chrome-stable";
|
2015-11-08 17:55:47 +00:00
|
|
|
};
|
google-chrome: move independently of `chromium`
Historically, `google-chrome` used the version info and debian package
FOD provided by `chromium`.
This was very efficient, because `chromium` uses parts of the debian
tarball for Widevine (opt-in, via `.override`).
Meaning `chromium` has to track that debian tarball with each update
anyway.
And they always release in sync.
So why keep seperate `google-chrome` from `chromium` now?
- The current `chromium` maintainers are already at capacity
maintaining `chromium` and have no time for `google-chrome`.
- `chromium` bumps become sometimes a bottleneck for `google-chrome`.
This is because `chromium` is built from source and a lot more time
consuming and significantly more complex.
- Lately, `chromium` and `google-chrome` both had an upstream issue
under wayland with `--ozone-platform-hint`, rendering it unusable.
For `chromium` we were able to patch it, since unlike `google-chrome`
it's built from source.
The `chromium` maintainers simply forgot that `google-chrome` might
have the same issue, continued to merge the PR, rendering
`google-chrome` broken.
This PR also removes primeos from `meta.maintainers` since they only
added themself to `google-chrome` because it inherited `chromium`'s
version, stating they don't actually use `google-chrome`.
Furthermore, primeos no longer maintains `chromium`.
Ref 477e7d6b60e817661632ff3a8aaf2e39c4cceadc
2024-05-01 22:43:15 +01:00
|
|
|
})
|