Run android apps in nixos?

What’s the way to run android apps in nixos these days? Both anbox and androidenv.emulateApp are broken and can’t simply downgrade with older nixpkgs version…

2 Likes

There is an open PR that fixes Anbox (anbox: fixes and upgrades by samueldr · Pull Request #125600 · NixOS/nixpkgs · GitHub), but at this point it’s only a draft and Anbox also requires two non-mainline non-default kernel modules, so you have to recompile the kernel.

If you want to use the emulator, you can have a look at robotnix which provides emulator targets for different Android flavors:

Note however, that robotnix will compile the entire Android OS from source which needs a gigantic amount of resources.

2 Likes

Wow, tons of work has been done in this project robotnix. Thank you.

Both of them have been mainlined for quite a while, we just don’t enable them by default yet.

1 Like

Yes, you’re right. Sorry about the confusion. It still stands though, that you have to recompiled the kernel.

However, the Xanmod kernel patchset compiles these modules by default, so using

{
  boot.kernelPackages = pkgs.linuxPackages_xanmod;
}

might save you from recompiling (given that you are fine with all other modifications introduced by Xanmod).

1 Like

However, recent linux kernel has ashmem removed (in favor of memfd). So, old instructions don’t work…

1 Like