2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, rustPlatform, fetchFromGitHub, fetchzip, androidenv, makeWrapper }:
|
2018-06-22 14:57:37 +02:00
|
|
|
let
|
2020-08-29 14:00:00 +02:00
|
|
|
version = "2.5";
|
2018-06-22 14:57:37 +02:00
|
|
|
apk = stdenv.mkDerivation {
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "gnirehtet.apk";
|
|
|
|
inherit version;
|
2018-06-22 14:57:37 +02:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/Genymobile/gnirehtet/releases/download/v${version}/gnirehtet-rust-linux64-v${version}.zip";
|
2020-08-29 14:00:00 +02:00
|
|
|
sha256 = "1db0gkg5z8lighhkyqfsr9jiacrck89zmfnmp74vj865hhxgjzgq";
|
2018-06-22 14:57:37 +02:00
|
|
|
};
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
mv gnirehtet.apk $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
2019-08-13 23:52:01 +02:00
|
|
|
rustPlatform.buildRustPackage {
|
2019-08-31 13:41:23 +02:00
|
|
|
pname = "gnirehtet";
|
|
|
|
inherit version;
|
2018-06-22 14:57:37 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Genymobile";
|
|
|
|
repo = "gnirehtet";
|
|
|
|
rev = "v${version}";
|
2020-08-29 14:00:00 +02:00
|
|
|
sha256 = "0wk6n082gnj9xk46n542h1012h8gyhldca23bs7vl73g0534g878";
|
2018-06-22 14:57:37 +02:00
|
|
|
};
|
|
|
|
sourceRoot = "source/relay-rust";
|
2021-05-07 13:00:49 +02:00
|
|
|
cargoSha256 = "03r8ivsvmhi5f32gj4yacbyzanziymszya18dani53bq9zis9z31";
|
2018-06-22 14:57:37 +02:00
|
|
|
|
2020-08-29 14:00:00 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/gnirehtet \
|
|
|
|
--set GNIREHTET_APK ${apk}/gnirehtet.apk \
|
|
|
|
--set ADB ${androidenv.androidPkgs_9_0.platform-tools}/bin/adb
|
|
|
|
'';
|
2018-06-22 14:57:37 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-06-22 14:57:37 +02:00
|
|
|
description = "Reverse tethering over adb for Android";
|
|
|
|
longDescription = ''
|
|
|
|
This project provides reverse tethering over adb for Android: it allows devices to use the internet connection of the computer they are plugged on. It does not require any root access (neither on the device nor on the computer).
|
|
|
|
|
|
|
|
This relies on adb, make sure you have the required permissions/udev rules.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/Genymobile/gnirehtet";
|
2018-06-22 14:57:37 +02:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ symphorien ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|