Android Provisioning Module#
This module provides a declarative way to provision Android devices using ADB. It generates a shell script that enforces a desired state:
- Debloat: Disables packages via
pm disable-useror uninstalls them viapm uninstall -k --user 0. - Install: Installs APKs from specified URLs (idempotent).
- Sync: Pushes files from the Nix store/local path to the device.
Usage#
Import this module in your flake and use the provision function.
# modules/android/default.nix
{ pkgs, config }:
let
android = import ./modules/android { inherit pkgs; inherit (pkgs) lib; };
in
android.provision {
name = "my-device";
serial = "DEVICE_SERIAL"; # Optional
disable = [ "com.unwanted.system.app" ];
uninstall = [ "com.bloatware.app" ];
install = [
{
name = "F-Droid";
src = pkgs.fetchurl { ... };
}
];
files = {
"./local-file.png" = "/sdcard/Pictures/remote-file.png";
};
}