android adb and fastboot

This commit is contained in:
Daniel Langbein 2023-09-13 13:39:45 +02:00
parent c1eb1a091d
commit 5d2ce80867
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
3 changed files with 33 additions and 0 deletions

View File

@ -40,6 +40,7 @@ in
../../modules/firefox.nix ../../modules/firefox.nix
../../modules/thunderbird.nix ../../modules/thunderbird.nix
#../../modules/digikam.nix #../../modules/digikam.nix
#../../modules/android.nix
]; ];
networking.hostName = "yodaTab"; networking.hostName = "yodaTab";

View File

@ -40,6 +40,7 @@ in
../../modules/firefox.nix ../../modules/firefox.nix
../../modules/thunderbird.nix ../../modules/thunderbird.nix
../../modules/digikam.nix ../../modules/digikam.nix
../../modules/android.nix
]; ];
networking.hostName = "yodaTux"; networking.hostName = "yodaTux";

31
modules/android.nix Normal file
View File

@ -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"
'';
}