1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-13 04:04:35 +03:00
mobile-nixos/examples/installer/modules/adb.nix
2022-10-19 16:24:56 -04:00

20 lines
488 B
Nix

{ 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;
}