4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
52 lines
1.6 KiB
Nix
52 lines
1.6 KiB
Nix
{ lib, stdenv, rustPlatform, fetchFromGitHub, fetchzip, androidenv, makeWrapper }:
|
|
let
|
|
version = "2.5";
|
|
apk = stdenv.mkDerivation {
|
|
pname = "gnirehtet.apk";
|
|
inherit version;
|
|
src = fetchzip {
|
|
url = "https://github.com/Genymobile/gnirehtet/releases/download/v${version}/gnirehtet-rust-linux64-v${version}.zip";
|
|
sha256 = "1db0gkg5z8lighhkyqfsr9jiacrck89zmfnmp74vj865hhxgjzgq";
|
|
};
|
|
installPhase = ''
|
|
mkdir $out
|
|
mv gnirehtet.apk $out
|
|
'';
|
|
};
|
|
in
|
|
rustPlatform.buildRustPackage {
|
|
pname = "gnirehtet";
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Genymobile";
|
|
repo = "gnirehtet";
|
|
rev = "v${version}";
|
|
sha256 = "0wk6n082gnj9xk46n542h1012h8gyhldca23bs7vl73g0534g878";
|
|
};
|
|
sourceRoot = "source/relay-rust";
|
|
cargoSha256 = "0i7f52r697gjw30m8k60hd3y6wsn5lpz419r083a1rhpbinzd26q";
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/gnirehtet \
|
|
--set GNIREHTET_APK ${apk}/gnirehtet.apk \
|
|
--set ADB ${androidenv.androidPkgs_9_0.platform-tools}/bin/adb
|
|
'';
|
|
|
|
meta = with 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;
|
|
};
|
|
}
|
|
|