1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2025-01-06 03:27:17 +03:00
mobile-nixos/examples/installer/modules/adb.nix

20 lines
488 B
Nix
Raw Normal View History

2021-06-17 02:54:57 +03:00
{ config, lib, ... }:
let
# 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
{
mobile.adbd.enable = lib.mkDefault enableADB;
}