Unverified Commit d95e9bf3 authored by John Titor's avatar John Titor
Browse files

google-chrome: add update-script

parent d49f993b
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
{ 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/";