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 "https://github.com/danielfullmer/robotnix/archive/master.tar.gz" \
    --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:

21 Likes

I have some good follow-up news on the project:

Robotnix has been accepted to receive funding from NLNet through their NGI Zero grant program. With this funding, we aim to improve the project with a focus on in a few main areas:

  1. Creating development / build infrastructure
  2. Improving Robotnix usability
  3. Leveraging Robotnix to build additional Android-related projects

This funded effort should last through a good portion of the remainder of this year. In the near-term (coming weeks/months), I intend to work on improving Robotnix documentation, creating automated build / test infrastructure, and producing “reproducibility reports” for Robotnix-built Android. @ajs124 will also be contributing to certain upcoming milestones, specifically, improving LineageOS support and developing an optional module to include certain Google apps.

I’m excited for the opportunity to be able to commit additional time to work on this project, and I’m very grateful to NLNet for their support.

This is also a good opportunity to plug the newly created IRC channel. Come by and ask any questions you might have at #robotnix on Freenode.

8 Likes