diff options
author | tv <tv@krebsco.de> | 2022-12-30 17:38:23 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2022-12-30 20:14:38 +0100 |
commit | 78e2a32680d572b38d3df2d00170e5234c6e88f1 (patch) | |
tree | c40b6548b7c568ec326225c48cafefff65735660 /tv/2configs | |
parent | 7d9eab0ae6efc35eee892e55cb81472357c5ebcb (diff) |
tv autotether: init
Diffstat (limited to 'tv/2configs')
-rw-r--r-- | tv/2configs/autotether.nix | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tv/2configs/autotether.nix b/tv/2configs/autotether.nix new file mode 100644 index 0000000..43b5575 --- /dev/null +++ b/tv/2configs/autotether.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: let + cfg.serial = "17e064850405"; +in { + systemd.services.usb_tether.serviceConfig = { + SyslogIdentifier = "usb_tether"; + ExecStartPre = "${pkgs.android-tools}/bin/adb -s ${cfg.serial} wait-for-device"; + ExecStart = "${pkgs.android-tools}/bin/adb -s ${cfg.serial} shell svc usb setFunctions rndis"; + }; + services.udev.extraRules = /* sh */ '' + ACTION=="add", SUBSYSTEM=="net", KERNEL=="usb*", NAME="android" + + ACTION=="add", SUBSYSTEM=="usb", ATTR{serial}=="${cfg.serial}", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}="usb_tether.service" + ''; + systemd.network.networks.android = { + matchConfig.Name = "android"; + DHCP = "yes"; + }; +} |