google-chrome: add update-script

This commit is contained in:
John Titor 2024-05-11 11:59:58 +05:30
parent d49f993b39
commit d95e9bf3a6
No known key found for this signature in database
GPG Key ID: 29B0514F4E3C1CC0

View File

@ -1,4 +1,4 @@
{ lib, stdenv, patchelf, makeWrapper, fetchurl
{ lib, stdenv, patchelf, makeWrapper, fetchurl, writeScript
# Linked dynamic libraries.
, glib, fontconfig, freetype, pango, cairo, libX11, libXi, atk, nss, nspr
@ -142,6 +142,17 @@ in stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru = {
updateScript = writeScript "update-google-chrome.sh" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
url="https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions/all/releases"
response=$(curl --silent $url)
version=$(jq ".releases[0].version" --raw-output <<< "$response")
update-source-version ${finalAttrs.pname} "$version" --ignore-same-hash
'';
};
meta = {
description = "A freeware web browser developed by Google";
homepage = "https://www.google.com/chrome/browser/";