nixpkgs/pkgs/tools/networking/gnirehtet/default.nix

56 lines
1.7 KiB
Nix
Raw Normal View History

2018-06-22 12:57:37 +00:00
{stdenv, rustPlatform, fetchFromGitHub, fetchzip, androidenv, substituteAll}:
let
2019-11-27 21:53:04 +00:00
version = "2.4";
2018-06-22 12:57:37 +00:00
apk = stdenv.mkDerivation {
2019-08-13 21:52:01 +00:00
pname = "gnirehtet.apk";
inherit version;
2018-06-22 12:57:37 +00:00
src = fetchzip {
url = "https://github.com/Genymobile/gnirehtet/releases/download/v${version}/gnirehtet-rust-linux64-v${version}.zip";
2019-11-27 21:53:04 +00:00
sha256 = "13gsh5982v961j86j5y71pgas94g2d1v1fgnbslbqw4h69fbf48g";
2018-06-22 12:57:37 +00:00
};
installPhase = ''
mkdir $out
mv gnirehtet.apk $out
'';
};
in
2019-08-13 21:52:01 +00:00
rustPlatform.buildRustPackage {
2019-08-31 11:41:23 +00:00
pname = "gnirehtet";
inherit version;
2018-06-22 12:57:37 +00:00
src = fetchFromGitHub {
owner = "Genymobile";
repo = "gnirehtet";
rev = "v${version}";
2019-11-27 21:53:04 +00:00
sha256 = "1c99d6zpjxa8xlrg0n1825am20d2pjiicfcjwv8iay9ylfdnvygl";
2018-06-22 12:57:37 +00:00
};
sourceRoot = "source/relay-rust";
# Delete this on next update; see #79975 for details
legacyCargoFetcher = true;
2019-11-27 21:53:04 +00:00
cargoSha256 = "1l1cirhmfkpa466vksynlhwggsfiahws7cpsxydrc414l415l283";
2018-06-22 12:57:37 +00:00
patchFlags = [ "-p2" ];
patches = [
(substituteAll {
src = ./paths.patch;
adb = "${androidenv.androidPkgs_9_0.platform-tools}/bin/adb";
2018-06-22 12:57:37 +00:00
inherit apk;
})
];
meta = with stdenv.lib; {
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.
'';
homepage = https://github.com/Genymobile/gnirehtet;
license = licenses.asl20;
maintainers = with maintainers; [ symphorien ];
platforms = platforms.unix;
};
}