diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-11-06 19:37:25 +0000 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-09-05 11:20:13 +0200 |
commit | de69b705d2afe755007a923ec5ab103c18cfa566 (patch) | |
tree | 91e39d5eb7532f9692b06e1e68d6a37a294f1fa7 /pkgs/applications/networking/browsers/chromium/default.nix | |
parent | 5811b6c1cd8b3a8c45e90945110461ca21c3616b (diff) | |
download | nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.tar nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.tar.gz nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.tar.bz2 nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.tar.lz nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.tar.xz nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.tar.zst nixpkgs-de69b705d2afe755007a923ec5ab103c18cfa566.zip |
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
Diffstat (limited to 'pkgs/applications/networking/browsers/chromium/default.nix')
-rw-r--r-- | pkgs/applications/networking/browsers/chromium/default.nix | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index efaaefce65a..1b3f284e1b3 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -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; }; } |