aboutsummaryrefslogtreecommitdiff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorIvan Kozik <ivan@ludios.org>2019-09-18 21:30:15 +0000
committerIvan Kozik <ivan@ludios.org>2019-09-19 00:05:30 +0000
commit5456def6b33dd215043a8b710ee52384309a3833 (patch)
treef1b8fd1fcdd646a59f8e7540d4a2884cb2599f70 /pkgs/applications
parent44957a9f3028edf538d5a70e58a736bc7026d3cb (diff)
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
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/networking/browsers/chromium/default.nix44
1 files changed, 29 insertions, 15 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index f099ddbff73..5fb0d67a480 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -50,6 +50,7 @@ in let
widevine = let upstream-info = chromium.upstream-info; in stdenv.mkDerivation {
name = "chromium-binary-plugin-widevine";
+ # The .deb file for Google Chrome
src = upstream-info.binary;
nativeBuildInputs = [ patchelfUnstable ];
@@ -57,14 +58,21 @@ in let
phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ];
unpackCmd = let
- chan = if upstream-info.channel == "dev" then "chrome-unstable"
- else if upstream-info.channel == "stable" then "chrome"
- else if upstream-info.channel == "beta" then "chrome-beta"
- else throw "Unknown chromium channel.";
+ soPath =
+ if upstream-info.channel == "stable" then
+ "./opt/google/chrome/libwidevinecdm.so"
+ else if upstream-info.channel == "beta" then
+ "./opt/google/chrome-beta/libwidevinecdm.so"
+ else if upstream-info.channel == "dev" then
+ "./opt/google/chrome-unstable/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
+ else
+ throw "Unknown chromium channel.";
in ''
mkdir -p plugins
- ar p "$src" data.tar.xz | tar xJ -C plugins --strip-components=4 \
- ./opt/google/${chan}/libwidevinecdm.so
+ # Extract just libwidevinecdm.so from upstream's .deb file
+ ar p "$src" data.tar.xz | tar xJ -C plugins ${soPath}
+ mv plugins/${soPath} plugins/
+ rm -rf plugins/opt
'';
doCheck = true;
@@ -83,7 +91,10 @@ in let
"$out/lib/libwidevinecdm.so"
'';
- meta.platforms = lib.platforms.x86_64;
+ meta = {
+ platforms = [ "x86_64-linux" ];
+ license = lib.licenses.unfree;
+ };
};
suffix = if channel != "stable" then "-" + channel else "";
@@ -92,18 +103,21 @@ in let
version = chromium.browser.version;
- # This is here because we want to add the widevine shared object at the last
- # minute in order to avoid a full rebuild of chromium. Additionally, this
- # isn't in `browser.nix` so we can avoid having to re-expose attributes of
- # the chromium derivation (see above: we introspect `sandboxExecutableName`).
+ # We want users to be able to enableWideVine without rebuilding all of
+ # chromium, so we have a separate derivation here that copies chromium
+ # and adds the unfree libwidevinecdm.so.
chromiumWV = let browser = chromium.browser; in if enableWideVine then
runCommand (browser.name + "-wv") { version = browser.version; }
''
mkdir -p $out
- cp -R ${browser}/* $out/
- chmod u+w $out/libexec/chromium*
- cp ${widevine}/lib/libwidevinecdm.so $out/libexec/chromium/
- # patchelf?
+ cp -a ${browser}/* $out/
+ chmod u+w $out/libexec/chromium
+ if [[ ${channel} != "dev" ]]; then
+ cp ${widevine}/lib/libwidevinecdm.so $out/libexec/chromium/
+ else
+ mkdir -p $out/libexec/chromium/WidevineCdm/_platform_specific/linux_x64
+ cp ${widevine}/lib/libwidevinecdm.so $out/libexec/chromium/WidevineCdm/_platform_specific/linux_x64/
+ fi
''
else browser;
in stdenv.mkDerivation {