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>

aszlig d3a7c503 b159458c

Changed files
+29 -6
pkgs
applications
networking
browsers
+2 -1
pkgs/applications/networking/browsers/chromium/default.nix
···
, proprietaryCodecs ? true
, enablePepperFlash ? false
, enablePepperPDF ? false
+
, enableWideVine ? false
, cupsSupport ? false
, pulseSupport ? false
, hiDPISupport ? false
···
sandbox = callPackage ./sandbox.nix { };
plugins = callPackage ./plugins.nix {
-
inherit enablePepperFlash enablePepperPDF;
+
inherit enablePepperFlash enablePepperPDF enableWideVine;
};
};
+27 -5
pkgs/applications/networking/browsers/chromium/plugins.nix
···
{ stdenv
, enablePepperFlash ? false
, enablePepperPDF ? false
+
, enableWideVine ? false
, source
}:
···
# 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"
···
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;
···
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
···
"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"
···
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);
};