Merge pull request #311202 from emilylange/chromium-drm

chromium: remove internal widevine drv in favor of `widevine-cdm`

authored by Ryan Lahfa and committed by GitHub a7cdcbc9 e56d6f0c

+3 -81
+3 -74
pkgs/applications/networking/browsers/chromium/default.nix
··· 5 5 , libva, pipewire, wayland 6 6 , gcc, nspr, nss, runCommand 7 7 , lib, libkrb5 8 + , widevine-cdm 8 9 , electron-source # for warnObsoleteVersionConditional 9 10 10 11 # package customization ··· 74 75 ungoogled-chromium = pkgsBuildBuild.callPackage ./ungoogled.nix {}; 75 76 }; 76 77 77 - pkgSuffix = if channel == "dev" then "unstable" else 78 - (if channel == "ungoogled-chromium" then "stable" else channel); 79 - pkgName = "google-chrome-${pkgSuffix}"; 80 - chromeSrc = 81 - let 82 - # Use the latest stable Chrome version if necessary: 83 - version = if chromium.upstream-info.hash_deb_amd64 != null 84 - then chromium.upstream-info.version 85 - else (import ./upstream-info.nix).stable.version; 86 - hash = if chromium.upstream-info.hash_deb_amd64 != null 87 - then chromium.upstream-info.hash_deb_amd64 88 - else (import ./upstream-info.nix).stable.hash_deb_amd64; 89 - in fetchurl { 90 - urls = map (repo: "${repo}/${pkgName}/${pkgName}_${version}-1_amd64.deb") [ 91 - "https://dl.google.com/linux/chrome/deb/pool/main/g" 92 - "http://95.31.35.30/chrome/pool/main/g" 93 - "http://mirror.pcbeta.com/google/chrome/deb/pool/main/g" 94 - "http://repo.fdzh.org/chrome/deb/pool/main/g" 95 - ]; 96 - inherit hash; 97 - }; 98 - 99 - mkrpath = p: "${lib.makeSearchPathOutput "lib" "lib64" p}:${lib.makeLibraryPath p}"; 100 - widevineCdm = stdenv.mkDerivation { 101 - name = "chrome-widevine-cdm"; 102 - 103 - src = chromeSrc; 104 - 105 - unpackCmd = let 106 - widevineCdmPath = 107 - if (channel == "stable" || channel == "ungoogled-chromium") then 108 - "./opt/google/chrome/WidevineCdm" 109 - else if channel == "beta" then 110 - "./opt/google/chrome-beta/WidevineCdm" 111 - else if channel == "dev" then 112 - "./opt/google/chrome-unstable/WidevineCdm" 113 - else 114 - throw "Unknown chromium channel."; 115 - in '' 116 - # Extract just WidevineCdm from upstream's .deb file 117 - ar p "$src" data.tar.xz | tar xJ "${widevineCdmPath}" 118 - 119 - # Move things around so that we don't have to reference a particular 120 - # chrome-* directory later. 121 - mv "${widevineCdmPath}" ./ 122 - 123 - # unpackCmd wants a single output directory; let it take WidevineCdm/ 124 - rm -rf opt 125 - ''; 126 - 127 - doCheck = true; 128 - checkPhase = '' 129 - ! find -iname '*.so' -exec ldd {} + | grep 'not found' 130 - ''; 131 - 132 - PATCH_RPATH = mkrpath [ gcc.cc glib nspr nss ]; 133 - 134 - patchPhase = '' 135 - patchelf --set-rpath "$PATCH_RPATH" _platform_specific/linux_x64/libwidevinecdm.so 136 - ''; 137 - 138 - installPhase = '' 139 - mkdir -p $out/WidevineCdm 140 - cp -a * $out/WidevineCdm/ 141 - ''; 142 - 143 - meta = { 144 - platforms = [ "x86_64-linux" ]; 145 - license = lib.licenses.unfree; 146 - }; 147 - }; 148 - 149 78 suffix = lib.optionalString (channel != "stable" && channel != "ungoogled-chromium") ("-" + channel); 150 79 151 80 sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName; ··· 159 88 mkdir -p $out 160 89 cp -a ${browser}/* $out/ 161 90 chmod u+w $out/libexec/chromium 162 - cp -a ${widevineCdm}/WidevineCdm $out/libexec/chromium/ 91 + cp -a ${widevine-cdm}/share/google/chrome/WidevineCdm $out/libexec/chromium/ 163 92 '' 164 93 else browser; 165 94 ··· 244 173 passthru = { 245 174 inherit (chromium) upstream-info browser; 246 175 mkDerivation = chromium.mkChromiumDerivation; 247 - inherit chromeSrc sandboxExecutableName; 176 + inherit sandboxExecutableName; 248 177 }; 249 178 } 250 179 # the following is a complicated and long-winded variant of
-5
pkgs/applications/networking/browsers/chromium/update.py
··· 20 20 from urllib.request import urlopen 21 21 22 22 RELEASES_URL = 'https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/all/versions/all/releases' 23 - DEB_URL = 'https://dl.google.com/linux/chrome/deb/pool/main/g' 24 23 25 24 PIN_PATH = dirname(abspath(__file__)) + '/upstream-info.nix' 26 25 UNGOOGLED_FLAGS_PATH = dirname(abspath(__file__)) + '/ungoogled-flags.toml' ··· 259 258 version 260 259 ) 261 260 src_hash_cache[version] = channel["hash"] 262 - 263 - channel['hash_deb_amd64'] = nix_prefetch_url( 264 - f'{DEB_URL}/google-chrome-{google_chrome_suffix}/' + 265 - f'google-chrome-{google_chrome_suffix}_{version}-1_amd64.deb') 266 261 except subprocess.CalledProcessError: 267 262 # This release isn't actually available yet. Continue to 268 263 # the next one.
-2
pkgs/applications/networking/browsers/chromium/upstream-info.nix
··· 16 16 }; 17 17 }; 18 18 hash = "sha256-nSI+tkJxOedMtYgtiqW37v0ZjgxxU5o/0sH9bPAchBg="; 19 - hash_deb_amd64 = "sha256-RvQdpDmWRcsASh1b8M0Zg+AvZprE5qhi14shfo0WlfE="; 20 19 version = "124.0.6367.201"; 21 20 }; 22 21 ungoogled-chromium = { ··· 33 32 }; 34 33 }; 35 34 hash = "sha256-nSI+tkJxOedMtYgtiqW37v0ZjgxxU5o/0sH9bPAchBg="; 36 - hash_deb_amd64 = "sha256-RvQdpDmWRcsASh1b8M0Zg+AvZprE5qhi14shfo0WlfE="; 37 35 version = "124.0.6367.201"; 38 36 }; 39 37 }