anchor.diff:  { stdenv
  +, fetchFromGitHub
   , fetchTritonPatch
  -, fetchzip
  +, fetchurl
  +, lib
   , which
   
   , boost
  
positive.code: 
    buildInputs = [
      boost
      libtorrent-rasterbar
      zlib
    ] ++ optionals (qt5 != null) [
      dbus
      qt5
    ];
  
    patches = [
      # The lrelease binary is named lrelease instead of lrelease-qt5
      (fetchTritonPatch {
        rev = "2b33aa1bf7a7c334e1099e7de4f05a11065c698c";
        file = "qbittorrent/qbittorrent-fix-lrelease.patch";
        sha256 = "cfe72a7016e1ea1d23032654350c230f149189457deeb6d8b491eff6dac1e7ff";
      })
    ];
  
    configureFlags = [
      "--disable-debug"
      (enFlag "gui" (qt5 != null) null)
      "--enable-systemd"
      (enFlag "webui" webuiSupport null)
      (enFlag "qt-dbus" (qt5 != null && dbus != null) null)
      "--without-qt4"
      "--with-qtsingleapplication=shipped"
      "--with-qjson=system"
      "--with-boost=${boost.dev}"
      "--with-boost-libdir=${boost.lib}/lib"
      "--with-boost-system"
    ];
  
    meta = with stdenv.lib; {
      description = "BitTorrent client in C++ and Qt";
      homepage = http://www.qbittorrent.org/;
      license = licenses.gpl2;
      maintainers = with maintainers; [ ];
      platforms = with platforms;
        x86_64-linux;
    };
  
negative.code: , qt5
  , zlib
  
  , guiSupport ? false
  , webuiSupport ? true
  
  , channel ? "stable"
  }:
  
  assert guiSupport -> dbus != null;
  
  let
    inherit (lib)
      boolEn
      optionals;
  
    sources = {
      stable = {
        version = "3.3.15";
        sha256 = "a7bbc08a39912a15a496702e736a98c083011bbb14fe5f04440880d7e6b2ceae";
      };
      head = {
        fetchzipversion = 3;
        version = "2017-08-14";
        rev = "ea749bb052cc866ca70876b213fb057ecd69f33e";
        sha256 = "dcdf4d98e6eaa04c05a34e8c03575015e4176ae448ab9523495d2eaa2aa380dd";
      };
    };
    source = sources."${channel}";
  in
  stdenv.mkDerivation rec {
    name = "qbittorrent-${source.version}";
  
    src =
      if channel != "head" then
        fetchurl {
          url = "mirror://sourceforge/qbittorrent/qbittorrent/${name}/${name}.tar.xz";
          hashOutput = false;
          inherit (source) sha256;
        }
      else
        fetchFromGitHub {
          version = source.fetchzipversion;
          owner = "qbittorrent";
          repo = "qbittorrent";
          inherit (source) rev sha256;
        };
  
    nativeBuildInputs = [
      which
  