summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Cohen <willcohen@users.noreply.github.com>2022-02-17 21:32:53 -0500
committerehmry <ehmry@posteo.net>2022-02-20 07:59:30 -0600
commit4994cd3f8ed1778d8bf77ee39f75ec435006f25a (patch)
tree6c244265ad684ba613a0acb918e8ec5f1a5e1ec7
parented39a3ffba221a2a98d510d6f04bdb8658e01f2b (diff)
downloadnixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.tar
nixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.tar.gz
nixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.tar.bz2
nixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.tar.lz
nixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.tar.xz
nixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.tar.zst
nixpkgs-4994cd3f8ed1778d8bf77ee39f75ec435006f25a.zip
tuntox: init at 0.0.10
-rw-r--r--pkgs/tools/networking/tuntox/default.nix80
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/tools/networking/tuntox/default.nix b/pkgs/tools/networking/tuntox/default.nix
new file mode 100644
index 00000000000..8870f0e32ce
--- /dev/null
+++ b/pkgs/tools/networking/tuntox/default.nix
@@ -0,0 +1,80 @@
+{ lib
+, stdenv
+, cscope
+, fetchFromGitHub
+, fetchpatch
+, git
+, libevent
+, libopus
+, libsodium
+, libtoxcore
+, libvpx
+, pkg-config
+, python3
+, python3Packages
+}:
+
+stdenv.mkDerivation rec {
+  pname = "tuntox";
+  version = "0.0.10";
+
+  src = fetchFromGitHub {
+    owner = "gjedeer";
+    repo = pname;
+    rev = "${version}";
+    sha256 = "sha256-c/0OxUH8iw8nRuVg4Fszf6Z/JiEV+m0B2ofzy81uFu8=";
+  };
+
+  nativeBuildInputs = [ cscope git pkg-config ];
+
+  buildInputs = [ libopus libtoxcore libsodium libevent libvpx python3 ];
+
+  pythonBuildInputs = with python3Packages; [
+    jinja2
+    requests
+  ];
+
+  patches = [
+    # https://github.com/gjedeer/tuntox/pull/67
+    (fetchpatch {
+      url = "https://github.com/gjedeer/tuntox/compare/a646402f42e120c7148d4de29dbdf5b09027a80a..365d2e5cbc0e3655fb64c204db0515f5f4cdf5a4.patch";
+      sha256 = "sha256-P3uIRnV+pBi3s3agGYUMt2PZU4CRxx/DUR8QPVQ+UN8=";
+    })
+  ];
+
+  postPatch = ''
+      substituteInPlace gitversion.h --replace '7d45afdf7d00a95a8c3687175e2b1669fa1f7745' '365d2e5cbc0e3655fb64c204db0515f5f4cdf5a4'
+    '' + lib.optionalString stdenv.isLinux ''
+      substituteInPlace Makefile --replace ' -static ' ' '
+      substituteInPlace Makefile --replace 'CC=gcc' ' '
+    '' + lib.optionalString stdenv.isDarwin ''
+      substituteInPlace Makefile.mac --replace '.git/HEAD .git/index' ' '
+      substituteInPlace Makefile.mac --replace '/usr/local/lib/libtoxcore.a' '${libtoxcore}/lib/libtoxcore.a'
+      substituteInPlace Makefile.mac --replace '/usr/local/lib/libsodium.a' '${libsodium}/lib/libsodium.dylib'
+      substituteInPlace Makefile.mac --replace 'CC=gcc' ' '
+    '';
+
+  buildPhase = ''
+    '' + lib.optionalString stdenv.isLinux ''
+      make
+    '' + lib.optionalString stdenv.isDarwin ''
+      make -f Makefile.mac tuntox
+    '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mv tuntox $out/bin/
+  '';
+
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Tunnel TCP connections over the Tox protocol";
+    homepage = "https://github.com/gjedeer/tuntox";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [
+      willcohen
+    ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index baaed561228..87c2377eb77 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10536,6 +10536,8 @@ with pkgs;
 
   trytond = with python3Packages; toPythonApplication trytond;
 
+  tuntox = callPackage ../tools/networking/tuntox { };
+
   omapd = callPackage ../tools/security/omapd { };
 
   ttf2pt1 = callPackage ../tools/misc/ttf2pt1 { };