mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 19:23:01 +03:00
6f6940226a
(Though it may require fiddling with udev perms)
39 lines
814 B
Nix
39 lines
814 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
options.mobile.adbd = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enables adbd on the device.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.mobile.adbd.enable {
|
|
assertions = [
|
|
{ assertion = config.mobile.boot.stage-1.usb.enable;
|
|
message = "adb requires mobile.boot.stage-1.usb.enable = true";
|
|
}
|
|
];
|
|
|
|
mobile.boot.stage-1 = {
|
|
usb.features = [ "adb" ];
|
|
|
|
extraUtils = with pkgs; [{
|
|
package = adbd;
|
|
extraCommand = ''cp -fpv "${glibc.out}"/lib/libnss_files.so.* "$out"/lib/'';
|
|
}];
|
|
};
|
|
|
|
boot.postBootCommands = ''
|
|
# Restart adbd early during stage-2
|
|
${pkgs.procps}/bin/pkill -x adbd
|
|
${pkgs.adbd}/bin/adbd &
|
|
'';
|
|
};
|
|
}
|