anchor.diff:  
       substituteInPlace libhb/module.defs \
         --replace /usr/include/libxml2 ${libxml2.dev}/include/libxml2
  -    substituteInPlace libhb/module.defs \
  -      --replace '$(CONTRIB.build/)include/libxml2' ${libxml2.dev}/include/libxml2
   
       # Force using nixpkgs dependencies
       sed -i '/MODULES += contrib/d' make/include/main.defs
  -    sed -i '/PKG_CONFIG_PATH=/d' gtk/module.rules
       sed -e 's/^[[:space:]]*\(meson\|ninja\|nasm\)[[:space:]]*= ToolProbe.*$//g' \
           -e '/    ## Additional library and tool checks/,/    ## MinGW specific library and tool checks/d' \
           -i make/configure.py
  
positive.code: 
  stdenv.mkDerivation rec {
    pname = "handbrake";
    version = "1.3.1";
  
    src = fetchurl {
      url = ''https://download.handbrake.fr/releases/${version}/HandBrake-${version}-source.tar.bz2'';
      sha256 = "09rcrq0kjs1lc1as7w3glbpbfvzldwpx3xv0pfmkn4pl7acxw1f0";
    };
  
    nativeBuildInputs = [
      python2 pkgconfig autoconf automake libtool m4
    ] ++ lib.optionals useGtk [ intltool wrapGAppsHook ];
  
    buildInputs = [
  
negative.code: # be nice to add the native GUI (and/or the GTK GUI) as an option too, but that
  # requires invoking the Xcode build system, which is non-trivial for now.
  
  { stdenv, lib, fetchurl,
    # Main build tools
    pkgconfig, autoconf, automake, libtool, m4, lzma, python3,
    numactl,
    # Processing, video codecs, containers
    ffmpeg-full, nv-codec-headers, libogg, x264, x265, libvpx, libtheora, dav1d,
  