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 | 4a1bec5d9b6d2730a60ed332214159a86a27f319 (patch) | |
tree | cb63898d713fdd24cd3994658ac41cf9f80005fe /tv | |
parent | 9cb022698e629c59e984c10e9cd7e123eab1fbda (diff) |
tv autotether: init
Diffstat (limited to 'tv')
-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 000000000..43b5575c8 --- /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"; + }; +} |