| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | { pkgs, ... }: |
| 2 | { |
| 3 | users.groups.adb = { }; |
| 4 | users.users.adb = { |
| 5 | isSystemUser = true; |
| 6 | group = "adb"; |
| 7 | home = "/var/lib/adb"; |
| 8 | createHome = true; |
| 9 | }; |
| 10 | |
| 11 | # Any device exposing the ADB interface (class ff, subclass 42, protocol 01). |
| 12 | services.udev.extraRules = '' |
| 13 | SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:ff4201:*", GROUP="adb", MODE="0660" |
| 14 | ''; |
| 15 | |
| 16 | # Containers reach attached Android devices with `adb -H 10.88.0.1`. The server |
| 17 | # has no authentication, so only podman0 may connect. |
| 18 | systemd.services.adb = { |
| 19 | wantedBy = [ "multi-user.target" ]; |
| 20 | environment.HOME = "/var/lib/adb"; |
| 21 | serviceConfig = { |
| 22 | User = "adb"; |
| 23 | ExecStart = "${pkgs.android-tools}/bin/adb -a server nodaemon"; |
| 24 | Restart = "always"; |
| 25 | }; |
| 26 | }; |
| 27 | networking.firewall.interfaces.podman0.allowedTCPPorts = [ 5037 ]; |
| 28 | } |