summary refs log tree commit diff
path: root/pkgs/tools/networking/toxvpn/default.nix
blob: c7fa1c7a271944d4a688a770462b35c4f4fb271e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ stdenv, fetchFromGitHub, cmake, nlohmann_json,
libtoxcore, libsodium, systemd, libcap, zeromq }:

with stdenv.lib;

let
  systemdOrNull = if stdenv.system == "x86_64-darwin" then null else systemd;
  if_systemd = optional (systemdOrNull != null);
in stdenv.mkDerivation rec {
  name = "toxvpn-${version}";
  version = "2017-06-25";

  src = fetchFromGitHub {
    owner  = "cleverca22";
    repo   = "toxvpn";
    rev    = "7bd6f169d69c511affa8c9672e8f794e4e205a44";
    sha256 = "1km8hkrxmrnca1b49vbw5kyldayaln5plvz78vhf8325r6c5san0";
  };

  buildInputs = [ libtoxcore nlohmann_json libsodium zeromq ]
    ++ if_systemd systemd
    ++ optional (stdenv.system != "x86_64-darwin") libcap;
  nativeBuildInputs = [ cmake ];

  cmakeFlags = optional stdenv.isLinux [ "-DSYSTEMD=1" ];

  postInstall = "$out/bin/toxvpn -h";

  meta = with stdenv.lib; {
    description = "A powerful tool that allows one to make tunneled point to point connections over Tox";
    homepage    = https://github.com/cleverca22/toxvpn;
    license     = licenses.gpl3;
    maintainers = with maintainers; [ cleverca22 obadz ];
    platforms   = platforms.linux ++ platforms.darwin;
  };
}