From 5d2ce80867c34976e6499b21287a2fc185a67a57 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 13 Sep 2023 13:39:45 +0200 Subject: [PATCH] android adb and fastboot --- hosts/yodaTab/configuration.nix | 1 + hosts/yodaTux/configuration.nix | 1 + modules/android.nix | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 modules/android.nix diff --git a/hosts/yodaTab/configuration.nix b/hosts/yodaTab/configuration.nix index 3e6dfee..5f4e204 100644 --- a/hosts/yodaTab/configuration.nix +++ b/hosts/yodaTab/configuration.nix @@ -40,6 +40,7 @@ in ../../modules/firefox.nix ../../modules/thunderbird.nix #../../modules/digikam.nix + #../../modules/android.nix ]; networking.hostName = "yodaTab"; diff --git a/hosts/yodaTux/configuration.nix b/hosts/yodaTux/configuration.nix index 640dde1..d294647 100644 --- a/hosts/yodaTux/configuration.nix +++ b/hosts/yodaTux/configuration.nix @@ -40,6 +40,7 @@ in ../../modules/firefox.nix ../../modules/thunderbird.nix ../../modules/digikam.nix + ../../modules/android.nix ]; networking.hostName = "yodaTux"; diff --git a/modules/android.nix b/modules/android.nix new file mode 100644 index 0000000..e4b26e2 --- /dev/null +++ b/modules/android.nix @@ -0,0 +1,31 @@ +{ config, pkgs, ... }: + +{ + # adb and fastboot + + # https://nixos.wiki/wiki/Android#adb_setup + programs.adb.enable = true; + users.users.yoda.extraGroups = [ "adbusers" "plugdev" ]; + + # plugdev group: https://developer.android.com/studio/run/device + # How to add user to new group: https://superuser.com/a/1352988 + users.groups.plugdev = {}; + + # `adb devices` returned the error: no permissions (missing udev rules? user is in the plugdev group) + # So I troed two things. The first one had no effect. But the second one fixed it. + + #services.udev.packages = [ + # pkgs.android-udev-rules + #]; + + # `lsusb` + #=> Bus 001 Device 008: ID 2a70:d001 OnePlus Technology (Shenzhen) Co., Ltd. ONEPLUS A6003 + # https://stackoverflow.com/a/53887437 + # + # After adding this, `adb devices` returnes: + #=> List of devices attached + #=> 21801e97 sideload + services.udev.extraRules = '' + SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", ATTR{idProduct}=="d001", MODE="0666", GROUP="plugdev" + ''; +}