authoravatarclover caruso<git@paperclover.net>2026-11-24 04:18:49-08:00
committeravatarclover caruso<git@paperclover.net>2026-11-30 03:08:43-08:00
logb061cf9d1c5d6098df987ff3609ace00dcc0bac8
tree8d7aced128932fb75754cd8906ce13464f87e1ec
parent555fb8f8ca12f00bc8c87a976ea3beecbfcb3496
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Expose attached Android devices to containers through a host adb server

Assisted-by: claude-sonnet-5.5

2 files changed, 29 insertions(+), 1 deletions(-)

nixos/adb.nix created+28
...@@ -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}
nixos/snowglobe.nix+1-1
...@@ -19,7 +19,7 @@ let...@@ -19,7 +19,7 @@ let
19 };19 };
20in20in
21{21{
22 imports = [ ./snowglobe-network.nix ./mac-studio-sandbox.nix ./knife-linux.nix ./mac-vm.nix ./ext-mantikafasi.nix ./ext-rachel.nix ./vm-disks.nix ./zfs-read-cache.nix ./gpu-unlock.nix ];22 imports = [ ./snowglobe-network.nix ./mac-studio-sandbox.nix ./knife-linux.nix ./adb.nix ./mac-vm.nix ./ext-mantikafasi.nix ./ext-rachel.nix ./vm-disks.nix ./zfs-read-cache.nix ./gpu-unlock.nix ];
2323
24 networking.hostName = "snowglobe";24 networking.hostName = "snowglobe";
25 environment.etc."machine-info".text = ''25 environment.etc."machine-info".text = ''