Robotnix -- build Android (AOSP) using Nix

Robotnix is a project which aims to make building Android ROMs as easy as running nix-build. For example:

nix-build "" \
    --arg configuration '{ device="crosshatch"; flavor="vanilla"; }' \
    -A img

After waiting for a very long time, this will produce an image which can be flashed onto a Pixel 3 XL phone (crosshatch) using fastboot.

For now, I have been focusing on Pixel devices, which receive monthly security updates from Google. Robotnix uses a NixOS-style module system to configure various aspects of the build, and includes modules providing support for vanilla AOSP, GrapheneOS, Chromium/Bromite/Vanadium webview, MicroG, seamless OTA updates, signed builds with verified boot, etc. See the repository for additional information.

My daily driver has been running a robotnix-built Android for almost a year, and I intend to keep up to date with Google’s monthly updates for the foreseeable future. In the past, it has produced working builds for Pixel XL, Pixel 2, and Pixel 3 XL phones. I am open to extending the codebase in generic ways to potentially handle other phones and different source repos, if there is enough developer interest.

Special thanks to @ajs124’s NixDroid, upon which Robotnix was initially based. Also thanks to @samueldr for Pixel 2 testing. Robotnix can be thought of as an interim solution until we reach “nix singularity” with Mobile NixOS. :smile: