chromium: replace update.nix with Python impl
update.nix was a huuuuge hack, abusing checksum collisions, etc., and was extremely difficult to read and maintain, especially because values from update.nix were also used in the derivations themselves! I've replaced this with an implementation in Python, which I chose for readability. Rather than generating Nix, I chose to generate JSON, since Python can do that in the standard library and Nix can read it. I also set update.py as an updateScript, so Chromium can now automatically be updated! Fixes: https://github.com/NixOS/nixpkgs/issues/89635
This commit is contained in:
committed by
Florian Klink
parent
5811b6c1cd
commit
de69b705d2
@@ -1,5 +1,5 @@
|
||||
{ newScope, config, stdenv, llvmPackages_10, llvmPackages_11
|
||||
, makeWrapper, ed, gnugrep, coreutils
|
||||
{ newScope, config, stdenv, fetchurl, makeWrapper
|
||||
, llvmPackages_10, llvmPackages_11, ed, gnugrep, coreutils
|
||||
, glib, gtk3, gnome3, gsettings-desktop-schemas, gn, fetchgit
|
||||
, libva ? null
|
||||
, pipewire_0_2
|
||||
@@ -31,10 +31,11 @@ let
|
||||
chromium = rec {
|
||||
inherit stdenv llvmPackages;
|
||||
|
||||
upstream-info = (callPackage ./update.nix {}).getChannel channel;
|
||||
upstream-info = (lib.importJSON ./upstream-info.json).${channel};
|
||||
|
||||
mkChromiumDerivation = callPackage ./common.nix ({
|
||||
inherit gnome gnomeSupport gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport useOzone;
|
||||
inherit channel gnome gnomeSupport gnomeKeyringSupport proprietaryCodecs
|
||||
cupsSupport pulseSupport useOzone;
|
||||
# TODO: Remove after we can update gn for the stable channel (backward incompatible changes):
|
||||
gnChromium = gn.overrideAttrs (oldAttrs: {
|
||||
version = "2020-05-19";
|
||||
@@ -63,22 +64,33 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
pkgSuffix = if channel == "dev" then "unstable" else channel;
|
||||
pkgName = "google-chrome-${pkgSuffix}";
|
||||
chromeSrc = fetchurl {
|
||||
url = map (repo: "${repo}/${pkgName}/${pkgName}_${version}-1_amd64.deb") [
|
||||
"https://dl.google.com/linux/chrome/deb/pool/main/g"
|
||||
"http://95.31.35.30/chrome/pool/main/g"
|
||||
"http://mirror.pcbeta.com/google/chrome/deb/pool/main/g"
|
||||
"http://repo.fdzh.org/chrome/deb/pool/main/g"
|
||||
];
|
||||
sha256 = chromium.upstream-info.sha256bin64;
|
||||
};
|
||||
|
||||
mkrpath = p: "${lib.makeSearchPathOutput "lib" "lib64" p}:${lib.makeLibraryPath p}";
|
||||
widevineCdm = let upstream-info = chromium.upstream-info; in stdenv.mkDerivation {
|
||||
widevineCdm = stdenv.mkDerivation {
|
||||
name = "chrome-widevine-cdm";
|
||||
|
||||
# The .deb file for Google Chrome
|
||||
src = upstream-info.binary;
|
||||
src = chromeSrc;
|
||||
|
||||
phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ];
|
||||
|
||||
unpackCmd = let
|
||||
widevineCdmPath =
|
||||
if upstream-info.channel == "stable" then
|
||||
if channel == "stable" then
|
||||
"./opt/google/chrome/WidevineCdm"
|
||||
else if upstream-info.channel == "beta" then
|
||||
else if channel == "beta" then
|
||||
"./opt/google/chrome-beta/WidevineCdm"
|
||||
else if upstream-info.channel == "dev" then
|
||||
else if channel == "dev" then
|
||||
"./opt/google/chrome-unstable/WidevineCdm"
|
||||
else
|
||||
throw "Unknown chromium channel.";
|
||||
@@ -211,6 +223,7 @@ in stdenv.mkDerivation {
|
||||
passthru = {
|
||||
inherit (chromium) upstream-info browser;
|
||||
mkDerivation = chromium.mkChromiumDerivation;
|
||||
inherit sandboxExecutableName;
|
||||
inherit chromeSrc sandboxExecutableName;
|
||||
updateScript = ./update.py;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user