git.iko.soy/typeable/nixpkgs
on master help sign in
chromiumDev: fix widevine support

Upstream moved libwidevinecdm.so from ./opt/google/chrome-unstable/libwidevinecdm.so to ./opt/google/chrome-unstable/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so

commit5456def6b33dd215043a8b710ee52384309a3833 authorIvan Kozik <ivan@ludios.org> dateWed 18 Sep 2019, 21:30 (7 years ago) parent44957a9
1 file changed+29−15
pkgs/applications/networking/browsers/chromium/default.nix+29−15
pkgs/applications/networking/browsers/chromium/default.nix+29−15
@@ -50,6 +50,7 @@ in let
5050 widevine = let upstream-info = chromium.upstream-info; in stdenv.mkDerivation {
5151 name = "chromium-binary-plugin-widevine";
5252
53+ # The .deb file for Google Chrome
5354 src = upstream-info.binary;
5455
5556 nativeBuildInputs = [ patchelfUnstable ];
@@ -57,14 +58,21 @@ in let
5758 phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ];
5859
5960 unpackCmd = let
60− chan = if upstream-info.channel == "dev" then "chrome-unstable"
61− else if upstream-info.channel == "stable" then "chrome"
62− else if upstream-info.channel == "beta" then "chrome-beta"
63− else throw "Unknown chromium channel.";
61+ soPath =
62+ if upstream-info.channel == "stable" then
63+ "./opt/google/chrome/libwidevinecdm.so"
64+ else if upstream-info.channel == "beta" then
65+ "./opt/google/chrome-beta/libwidevinecdm.so"
66+ else if upstream-info.channel == "dev" then
67+ "./opt/google/chrome-unstable/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
68+ else
69+ throw "Unknown chromium channel.";
6470 in ''
6571 mkdir -p plugins
66− ar p "$src" data.tar.xz | tar xJ -C plugins --strip-components=4 \
67− ./opt/google/${chan}/libwidevinecdm.so
72+ # Extract just libwidevinecdm.so from upstream's .deb file
73+ ar p "$src" data.tar.xz | tar xJ -C plugins ${soPath}
74+ mv plugins/${soPath} plugins/
75+ rm -rf plugins/opt
6876 '';
6977
7078 doCheck = true;
@@ -83,7 +91,10 @@ in let
8391 "$out/lib/libwidevinecdm.so"
8492 '';
8593
86− meta.platforms = lib.platforms.x86_64;
94+ meta = {
95+ platforms = [ "x86_64-linux" ];
96+ license = lib.licenses.unfree;
97+ };
8798 };
8899
89100 suffix = if channel != "stable" then "-" + channel else "";
@@ -92,18 +103,21 @@ in let
92103
93104 version = chromium.browser.version;
94105
95− # This is here because we want to add the widevine shared object at the last
96− # minute in order to avoid a full rebuild of chromium. Additionally, this
97− # isn't in `browser.nix` so we can avoid having to re-expose attributes of
98− # the chromium derivation (see above: we introspect `sandboxExecutableName`).
106+ # We want users to be able to enableWideVine without rebuilding all of
107+ # chromium, so we have a separate derivation here that copies chromium
108+ # and adds the unfree libwidevinecdm.so.
99109 chromiumWV = let browser = chromium.browser; in if enableWideVine then
100110 runCommand (browser.name + "-wv") { version = browser.version; }
101111 ''
102112 mkdir -p $out
103− cp -R ${browser}/* $out/
104− chmod u+w $out/libexec/chromium*
105− cp ${widevine}/lib/libwidevinecdm.so $out/libexec/chromium/
106− # patchelf?
113+ cp -a ${browser}/* $out/
114+ chmod u+w $out/libexec/chromium
115+ if [[ ${channel} != "dev" ]]; then
116+ cp ${widevine}/lib/libwidevinecdm.so $out/libexec/chromium/
117+ else
118+ mkdir -p $out/libexec/chromium/WidevineCdm/_platform_specific/linux_x64
119+ cp ${widevine}/lib/libwidevinecdm.so $out/libexec/chromium/WidevineCdm/_platform_specific/linux_x64/
120+ fi
107121 ''
108122 else browser;
109123in stdenv.mkDerivation {