1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00

examples/hello: Try to enable ADB

Also warn if it could not be enabled.
This commit is contained in:
Samuel Dionne-Riel 2021-01-27 22:15:37 -05:00
parent a96c2b845c
commit 9d93f32eeb

View File

@ -21,6 +21,19 @@ let
fsType = "tmpfs";
neededForBoot = true;
};
# Only enable `adb` if we know how to.
# FIXME: relies on implementation details. Poor separation of concerns.
enableADB =
let
value =
config.mobile.usb.mode == "android_usb" ||
(config.mobile.usb.mode == "gadgetfs" && config.mobile.usb.gadgetfs.functions ? adb)
;
in
if value then value else
builtins.trace "warning: unable to enable ADB for this device." value
;
in
{
imports = [
@ -73,11 +86,7 @@ in
};
};
# Only enable `adb` if we know how to.
# FIXME: relies on implementation details. Poor separation of concerns.
mobile.adbd.enable = (config.mobile.system.type == "android") &&
(config.mobile.usb.mode != "gadgetfs" || config.mobile.usb.gadgetfs.functions ? ffs)
;
mobile.adbd.enable = lib.mkDefault enableADB;
boot.postBootCommands = lib.mkOrder (-1) ''
brightness=10