anchor.diff:  # for Youtube support
   , quviSupport ? false, libquvi ? null
   , cacaSupport ? false, libcaca ? null
  -, vaapiSupport ? false, libva ? null }:
  +, vaapiSupport ? false, libva ? null
  +}:
   
   assert x11Support -> (libX11 != null && libXext != null && mesa != null && libXxf86vm != null);
   assert xineramaSupport -> (libXinerama != null && x11Support);
  
positive.code:   };
  }
  
  # Many thanks @matejc for this update: 0.5.0 and vaapi (experimental)
  
  # TODO: Wayland support
  # TODO: investigate libquvi problems (related to Youtube support)
  # TODO: investigate caca support
  
negative.code: 
  let
    waf = fetchurl {
      url = http://ftp.waf.io/pub/release/waf-1.7.16;
      sha256 = "b64dc26c882572415fd450b745006107965f3fe17b357e3eb43d6676c9635a61";
    };
  
  in
  
  stdenv.mkDerivation rec {
    name = "mpv-${version}";
    version = "0.5.4";
  
    src = fetchurl {
      url = "https://github.com/mpv-player/mpv/archive/v${version}.tar.gz";
      sha256 = "1n992nvylnh27jc6425daasq0nsxjfc1mxhhlhvlwzxm724x94xp";
    };
  
    buildInputs = with stdenv.lib;
      [ waf python3 lua perl freetype pkgconfig ffmpeg libass docutils which libpthreadstubs lua5_sockets ]
      ++ optionals x11Support [ libX11 libXext mesa libXxf86vm ]
      ++ optional alsaSupport alsaLib
      ++ optional xvSupport libXv
  