anchor.diff:  , qt5
   , zlib
   
  +, guiSupport ? false
   , webuiSupport ? true
  +
  +, channel ? "stable"
   }:
   
  +assert guiSupport -> dbus != null;
  +
   let
  -  inherit (stdenv.lib)
  -    enFlag
  +  inherit (lib)
  +    boolEn
       optionals;
   
  -  version = "3.3.5";
  +  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}";
   
  -assert qt5 != null -> dbus != null;
  -
  -stdenv.mkDerivation rec {
  -  name = "qbittorrent-" + version;
  -
  -  src = fetchzip {
  -    version = 1;
  -    url = "https://github.com/qbittorrent/qBittorrent/archive/"
  -      + "release-${version}.tar.gz";
  -    sha256 = "4dc222e0362765f57b2f9177e8f2f1fd2ecae6c0626b7a5ba6e4b4e0d3886de8";
  -  };
  +  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
  
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: { stdenv
  , fetchFromGitHub
  , fetchTritonPatch
  , fetchurl
  , lib
  , which
  
  , boost
  