anchor.diff: -{ stdenv, fetchurl, intltool, pkgconfig, fetchpatch
  +{ stdenv, fetchurl, intltool, pkgconfig, fetchpatch, jansson
   # deadbeef can use either gtk2 or gtk3
  -, gtk2Support ? true, gtk2 ? null
  -, gtk3Support ? false, gtk3 ? null, gsettings_desktop_schemas ? null, makeWrapper ? null
  +, gtk2Support ? false, gtk2 ? null
  +, gtk3Support ? true, gtk3 ? null, gsettings_desktop_schemas ? null, makeWrapper ? null
   # input plugins
   , vorbisSupport ? true, libvorbis ? null
   , mp123Support ? true, libmad ? null
  
positive.code: 
    enableParallelBuilding = true;
  
    patches = [ (fetchpatch {
                  url = "https://github.com/Alexey-Yakovenko/deadbeef/commit/e7725ea73fa1bd279a3651704870156bca8efea8.patch";
                  sha256 = "1530w968zyvcm9c8k57889n125k7a1kk3ydinjm398n07gypd599";
                })
              ];
  
    postInstall = if !gtk3Support then "" else ''
      wrapProgram "$out/bin/deadbeef" \
        --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
  
negative.code: assert remoteSupport -> curl != null;
  
  stdenv.mkDerivation rec {
    name = "deadbeef-${version}";
    version = "0.7.0";
  
    src = fetchurl {
      url = "mirror://sourceforge/project/deadbeef/${name}.tar.bz2";
      sha256 = "0s6qip1zs83pig75pnd30ayiv1dbbj7s72px9mr31f4m0v86kaqx";
    };
  
    buildInputs = with stdenv.lib; [ jansson ]
      ++ optional gtk2Support gtk2
      ++ optionals gtk3Support [ gtk3 gsettings_desktop_schemas ]
      ++ optional vorbisSupport libvorbis
      ++ optional mp123Support libmad
      ++ optional flacSupport flac
      ++ optional wavSupport libsndfile
      ++ optionals cdaSupport [ libcdio libcddb ]
      ++ optional aacSupport faad2
      ++ optional zipSupport libzip
      ++ optional ffmpegSupport ffmpeg
  