I'm working on new features of robotnix, which makes testing Android OS changes easier

robotnix is great, it makes setting up environment for Android OS development easier with the power of nix.

However, it’s currently missing features I need for local development.
robotnix is not trying to re-implement Android’s build system with nix. That makes very hard to implement incremental build, small changes to source code results in full rebuild of the image.

debugEnterEnv is very close to what I need, it sets up FHS environment with source files in nix store, but it unfortunatelly doesn’t allow editing files locally, since it bind-mounts files in nix store, which are read-only.

So, instead of implementing incremental build with nix, I added a new feature to robotnix that allows you to test changes locally. It’s already working, I’m testing to make sure that there aren’t issues with this approach.

Bind mounting local git checkout instead of read-only source files in nix store

Bind mounting links your source code stored locally (outside nix store) to one of source directory inside temporary directory, so that you can make changes locally.
Source directories you didn’t configure for local development are still bind mounted from nix store.

This is better than checking out repositories manually with repo manually, as it won’t require additional disk space, and uses the same source code revision for other dependencies.

Bind mounting of local directories can be toggled

Above configuration is loaded as part of source.dirs option, which means that you need to edit repo-lineage-17.1.json, if this feature doesn’t exist.
I didn’t want to edit repo-lineage-17.1.json directly since it’s a auto-generated file, regenerating this file causes localDir configuration to be lost.

So I added another option that toggles loading from repo-lineage-17.1.override.json. This file is merged with repo-lineage-17.1.json when enabled.
To enable, build debugEnterEnv script with source.enableLocalRepoFile=true;. You can switch back to original source code anytime by disabling this feature.

Currently only works with Waydroid build

The feature is only supported for Waydroid build. I’m also working on Waydroid support on robotnix.
Waydroid support was developed originally by the author of robotnix, I updated it to support the latest version of waydroid.

I added some documentation on the feature here: