lol

toxvpn: 20161230 -> 2017-06-25

+31 -10
+15 -1
nixos/modules/services/networking/toxvpn.nix
··· 18 18 default = 33445; 19 19 description = "udp port for toxcore, port-forward to help with connectivity if you run many nodes behind one NAT"; 20 20 }; 21 + 22 + auto_add_peers = mkOption { 23 + type = types.listOf types.string; 24 + default = []; 25 + example = ''[ "toxid1" "toxid2" ]''; 26 + description = "peers to automacally connect to on startup"; 27 + }; 21 28 }; 22 29 }; 23 30 ··· 33 40 chown toxvpn /run/toxvpn 34 41 ''; 35 42 43 + path = [ pkgs.toxvpn ]; 44 + 45 + script = '' 46 + exec toxvpn -i ${config.services.toxvpn.localip} -l /run/toxvpn/control -u toxvpn -p ${toString config.services.toxvpn.port} ${lib.concatMapStringsSep " " (x: "-a ${x}") config.services.toxvpn.auto_add_peers} 47 + ''; 48 + 36 49 serviceConfig = { 37 - ExecStart = "${pkgs.toxvpn}/bin/toxvpn -i ${config.services.toxvpn.localip} -l /run/toxvpn/control -u toxvpn -p ${toString config.services.toxvpn.port}"; 38 50 KillMode = "process"; 39 51 Restart = "on-success"; 40 52 Type = "notify"; ··· 42 54 43 55 restartIfChanged = false; # Likely to be used for remote admin 44 56 }; 57 + 58 + environment.systemPackages = [ pkgs.toxvpn ]; 45 59 46 60 users.extraUsers = { 47 61 toxvpn = {
+16 -9
pkgs/tools/networking/toxvpn/default.nix
··· 1 - { stdenv, fetchFromGitHub, cmake, lib 2 - , libtoxcore, jsoncpp, libsodium, systemd, libcap }: 1 + { stdenv, fetchFromGitHub, cmake, nlohmann_json, 2 + libtoxcore, libsodium, systemd, libcap, zeromq }: 3 3 4 - with lib; 4 + with stdenv.lib; 5 5 6 - stdenv.mkDerivation rec { 6 + let 7 + systemdOrNull = if stdenv.system == "x86_64-darwin" then null else systemd; 8 + if_systemd = optional (systemdOrNull != null); 9 + in stdenv.mkDerivation rec { 7 10 name = "toxvpn-${version}"; 8 - version = "20161230"; 11 + version = "2017-06-25"; 9 12 10 13 src = fetchFromGitHub { 11 14 owner = "cleverca22"; 12 15 repo = "toxvpn"; 13 - rev = "4b7498a5fae680484cb5779ac01fb08ad3089bdd"; 14 - sha256 = "0bazdspiym9xyzms7pd6i1f2gph13rnf764nm3jc27fbfwmc98rp"; 16 + rev = "7bd6f169d69c511affa8c9672e8f794e4e205a44"; 17 + sha256 = "1km8hkrxmrnca1b49vbw5kyldayaln5plvz78vhf8325r6c5san0"; 15 18 }; 16 19 17 - buildInputs = [ libtoxcore jsoncpp libsodium libcap ] ++ optional stdenv.isLinux systemd; 20 + buildInputs = [ libtoxcore nlohmann_json libsodium zeromq ] 21 + ++ if_systemd systemd 22 + ++ optional (stdenv.system != "x86_64-darwin") libcap; 18 23 nativeBuildInputs = [ cmake ]; 19 24 20 25 cmakeFlags = optional stdenv.isLinux [ "-DSYSTEMD=1" ]; 21 26 27 + postInstall = "$out/bin/toxvpn -h"; 28 + 22 29 meta = with stdenv.lib; { 23 30 description = "A powerful tool that allows one to make tunneled point to point connections over Tox"; 24 31 homepage = https://github.com/cleverca22/toxvpn; 25 32 license = licenses.gpl3; 26 33 maintainers = with maintainers; [ cleverca22 obadz ]; 27 - platforms = platforms.linux; 34 + platforms = platforms.linux ++ platforms.darwin; 28 35 }; 29 36 }