summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-09-30 06:00:47 +0200
committeraszlig <aszlig@redmoonstudios.org>2014-10-06 07:24:33 +0200
commitd3a7c503640437328d4069c22341d13ab02f152c (patch)
tree56ada7964a8a89115876ff1128754de9cc9d0bbc /pkgs
parentb159458c34314c1cb46da42b9aa071ce9a61268a (diff)
chromium: Add WideVine content decryption plugin.
Seems to be needed in order to view Netflix content, but this only pulls
in the proprietary plugin and doesn't yet compile Chromium with support
for it, so this is only in preparation for the bright and shiny future
(where we all have rootkits implanted in our body).

Of course, this plugin is disabled by default as well as all the other
proprietary plugins.

For the plugin derivation, we now do the checkPhase _after_ the
installPhase, to make sure we also detect RPATHs pointing to the plugin
directory itself, because the shared object files only exist after the
installPhase.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/networking/browsers/chromium/default.nix3
-rw-r--r--pkgs/applications/networking/browsers/chromium/plugins.nix32
2 files changed, 29 insertions, 6 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index 98e1fc6234ad7..14881d11601ea 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -10,6 +10,7 @@
 , proprietaryCodecs ? true
 , enablePepperFlash ? false
 , enablePepperPDF ? false
+, enableWideVine ? false
 , cupsSupport ? false
 , pulseSupport ? false
 , hiDPISupport ? false
@@ -35,7 +36,7 @@ let
     sandbox = callPackage ./sandbox.nix { };
 
     plugins = callPackage ./plugins.nix {
-      inherit enablePepperFlash enablePepperPDF;
+      inherit enablePepperFlash enablePepperPDF enableWideVine;
     };
   };
 
diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix
index e0c45f9107510..5bd4115863202 100644
--- a/pkgs/applications/networking/browsers/chromium/plugins.nix
+++ b/pkgs/applications/networking/browsers/chromium/plugins.nix
@@ -1,6 +1,7 @@
 { stdenv
 , enablePepperFlash ? false
 , enablePepperPDF ? false
+, enableWideVine ? false
 
 , source
 }:
@@ -14,8 +15,8 @@ let
     # XXX: Only temporary and has to be version-specific
     src = source.plugins;
 
-    phases = [ "unpackPhase" "patchPhase" "checkPhase" "installPhase" ];
-    outputs = [ "pdf" "flash" ];
+    phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ];
+    outputs = [ "pdf" "flash" "widevine" ];
 
     unpackCmd = let
       chan = if source.channel == "dev"    then "chrome-unstable"
@@ -25,7 +26,9 @@ let
       mkdir -p plugins
       ar p "$src" data.tar.lzma | tar xJ -C plugins --strip-components=4 \
         ./opt/google/${chan}/PepperFlash \
-        ./opt/google/${chan}/libpdf.so
+        ./opt/google/${chan}/libpdf.so \
+        ./opt/google/${chan}/libwidevinecdm.so \
+        ./opt/google/${chan}/libwidevinecdmadapter.so
     '';
 
     doCheck = true;
@@ -37,10 +40,14 @@ let
       rpaths = [ stdenv.gcc.gcc ];
       mkrpath = p: "${makeSearchPath "lib64" p}:${makeSearchPath "lib" p}";
     in ''
-      for sofile in PepperFlash/libpepflashplayer.so libpdf.so; do
+      for sofile in PepperFlash/libpepflashplayer.so libpdf.so \
+                    libwidevinecdm.so libwidevinecdmadapter.so; do
         chmod +x "$sofile"
         patchelf --set-rpath "${mkrpath rpaths}" "$sofile"
       done
+
+      patchelf --set-rpath "$widevine/lib:${mkrpath rpaths}" \
+        libwidevinecdmadapter.so
     '';
 
     installPhase = let
@@ -51,6 +58,12 @@ let
         "application/x-google-chrome-print-preview-pdf"
       ];
       pdfInfo = "#${pdfName}#${pdfDescription};${pdfMimeTypes}";
+
+      wvName = "Widevine Content Decryption Module";
+      wvDescription = "Playback of encrypted HTML audio/video content";
+      wvMimeTypes = "application/x-ppapi-widevine-cdm";
+      wvModule = "$widevine/lib/libwidevinecdmadapter.so";
+      wvInfo = "#${wvName}#${wvDescription}:${wvMimeTypes}";
     in ''
       install -vD libpdf.so "$pdf/lib/libpdf.so"
       mkdir -p "$pdf/nix-support"
@@ -67,11 +80,20 @@ let
       echo "--ppapi-flash-path='$flash/lib/libpepflashplayer.so'" \
            "--ppapi-flash-version=$flashVersion" \
            > "$flash/nix-support/chromium-flags"
+
+      install -vD libwidevinecdm.so \
+        "$widevine/lib/libwidevinecdm.so"
+      install -vD libwidevinecdmadapter.so \
+        "$widevine/lib/libwidevinecdmadapter.so"
+      mkdir -p "$widevine/nix-support"
+      echo "--register-pepper-plugins='${wvModule}${wvInfo}'" \
+        > "$widevine/nix-support/chromium-flags"
     '';
 
     passthru.flagsEnabled = let
       enabledPlugins = optional enablePepperFlash plugins.flash
-                    ++ optional enablePepperPDF   plugins.pdf;
+                    ++ optional enablePepperPDF   plugins.pdf
+                    ++ optional enableWideVine    plugins.widevine;
       getFlags = plugin: "$(< ${plugin}/nix-support/chromium-flags)";
     in concatStringsSep " " (map getFlags enabledPlugins);
   };