I just got my first Android phone after years on iPhone, and I’m exploring ways to use it as a lightweight dev environment.
Now that Android 16 has a native Linux terminal, I’m wondering: why would someone still choose nix-on-droid?
It seems like the main alternatives now are:
just use the built-in Debian AVF environment and install Nix / Home Manager there
use nixos-avf
So compared to those, what does nix-on-droid still offer?
EDIT: I should add that I’m using a Pixel 10 Pro. I think some other devices still don’t have good support for AVF, in which cases nix-on-droid is still needed.
Think my phone(s) are and will be on Android 15 for a while still, so I could not really try with AVF.
nix-on-droid is very fine for many tasks and i really appreciate having it, i.e., first of all nix, then having a shell handy, ssh, git, all of that terminal stuff that eases daily stuff on commute or whenever a bigger console is not available.
Things in nix-on-droid not (yet - or without further ado on user’s side) working:
termux integration, i.e., clipboard (though osc52 is no problem and enough for me)
sudo related stuff obviously (ping, strace and friends)
proot still from 24.05, but there is a pr
overall lagging a bit after nixos releases, currently 25.11 prerelease that seems to be working
last two points make breaking changes harder to catch if I use newer versions of a software
there is even an implementation of like nixos-test but on the base of proot which is very cool otoh bc integration testing or bisecting runtime errors possible without spamming device storage but otoh it is not that well documented - bc niche and yeah maintainer work who also do it all in their spare time
EDIT: My last point is not entirely true, testing was simplified in that PR and also not proot-specific.
Expect terrible performance with nix-on-droid - 10-15 minutes to even just load nixpkgs before evaluating anything, for example - due to the proot-based design. You’d be better off with a cheap machine that you can throw Linux on. (Or try the debian env if that performs better.)
Yes, it is important to outsource any build involved work to a remote builder of some kind, personally I use a combo of nixbuild.net and nix copy pragmatically.
For time to time repl usage to research something it is still acceptable even a lightly equipped neovim with nixd lsp does run fine not in comparison or getting started with a laptop screen but still, remember we talk cheap old / mid class phone users here - or do I ?
Eval is done locally, always. I mentioned eval only.
Anyway, OP was talking about a “lightweight dev environment”, not sure exactly what they have in mind - if they have a remote server they can easily ssh into it and run commands there, obviating the need for nix-on-droid entirely.
I can’t speak for the termux approach, but Rust compilation via crane seemed as fast as I would expect a bare metal Linux distro to run on this phone. Quite fast.
Of course you would expect that when running through KVM. It’s just crazy I can run all this on my phone now.
Expect terrible performance with nix-on-droid - 10-15 minutes to even just load nixpkgs before evaluating anything
It’s not that bad in my experience. The first rebuild after adding/changing inputs (if using flakes, I can’t speak for channel users) is slow, yes, but the next ones are decently fast (my full local reevaluation/rebuild without changing packages takes ~3 minutes), as is the case with normal NixOS. I am running a somewhat new-ish device though
My main gripe with Nix-on-Droid is that they rename some NixOS options for basically no benefit (environment.packages vs environmemt.systemPackages for example),and no the argument “we don’t manage the system so it doesn’t make sense to call it that” is not convincing)
Have you actually tried to use it? It’s interesting, but buggy as hell. Actually running real Linux on phones is far more stable and reliable, at least in my experience on Pixel 9 on GrapheneOS.
It’s my “lightweight dev station” for university (personal use, not classes), since I don’t have a portable machine (but I have a keyboard).
I also used it for hosting a web server exposed through Cloudflare Tunnels for quite a while, since at the time I didn’t have a machine running 24/7 at home. This wasn’t managed by Nix though, its only use for that was a dev shell with the Rust compiler and cloudflared in it
It’s definitely not ideal, and if I could I would use AVF instead, but alas I can’t, so I stick with Nix-on-Droid for now
Running Linux on a phone is also absurd - wildly insecure for a device that has so much sensor data, and Linux does not have MAC set up by default unless you use certain distros. Desktop Linux is generally insecure without proper safeguards.
AVF is probably fine due to the layer of separation.
That option is about specifying the store to use for eval. The computations are still happening locally to my knowledge - and we’d still suffer the file I/O penalty from down/upload (network operations may be even slower too). Still, haven’t benchmarked it myself.