{ stdenv, fetchurl, autoconf, libtool, automake, libsodium, ncurses
, libtoxcore, openal, libvpx, freealut, libconfig, pkgconfig }:

let
  version = "0.5.1";
in stdenv.mkDerivation rec {
  name = "toxic-${version}";

  src = fetchurl {
    url = "https://github.com/Tox/toxic/archive/v${version}.tar.gz";
    sha256 = "0zzfgwm17a4xcy9l0ll2pksp45mz6f4s3isdrgjpw1xibv9xnzcm";
  };

  makeFlags = [ "-Cbuild" "VERSION=${version}" "PREFIX=$(out)" ];
  installFlags = [ "PREFIX=$(out)" ];

  buildInputs = [
    autoconf libtool automake libtoxcore libsodium ncurses
    libconfig pkgconfig
  ] ++ stdenv.lib.optionals (!stdenv.isArm) [
    openal libvpx freealut
  ];

  meta = {
    description = "Reference CLI for Tox";
    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with stdenv.lib.maintainers; [ viric ];
    platforms = stdenv.lib.platforms.all;
  };
}

{ stdenv, fetchFromGitHub, autoconf, libtool, automake, libsodium, ncurses
, libtoxcore, openal, libvpx, freealut, libconfig, pkgconfig }:

stdenv.mkDerivation rec {
  name = "toxic-dev-20141130";

  src = fetchFromGitHub {
    owner = "Tox";
    repo = "toxic";
    rev = "4acfe84171";
    sha256 = "1yqglh9fm75zph4fzf3z4gwmamngypwpvb7shpqgakdg8ybq0a8s";
  };

  makeFlags = [ "-Cbuild" "PREFIX=$(out)" ];
  installFlags = [ "PREFIX=$(out)" ];

  buildInputs = [
    autoconf libtool automake libtoxcore libsodium ncurses
    libconfig pkgconfig
  ] ++ stdenv.lib.optionals (!stdenv.isArm) [
    openal libvpx freealut
  ];

  meta = with stdenv.lib; {
    description = "Reference CLI for Tox";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ viric jgeerds ];
    platforms = platforms.all;
  };
}

Update to the newest dev version
toxic: Update to the newest dev version

This update is necessary due to API changes in libtoxcore. Sad to say that
the recent stable version doesn't work with our libtoxcore. We need to
update to the recent dev version.
