I succeeded in running Nix on Android (now without Termux!)


#1

I like the usability and discoverability of Termux (unprivileged Linux distro targeting Android), but the idea of painfully recreating a distro with Android toolchain / bionic sounds horrible. I felt like the flexibility of Nix would save the day the best way ever, and yesterday I finally bought an aarch64 tablet to give it a go.

Sorry if this is common knowledge, but I couldn’t find a guide or a script anywhere and cobbled my own one.

Limitations: requires Termux, relies on proot pseudo-bind-mounts, only works on aarch64 (and maybe x86).

Pros: does not require root, user namespaces or disabling SELinux. Also, it frigging works!

Quickstart:

UPDATE 1: I’ve started something even better, a separate app bringing Nix to your device without relying on Termux the distro. Test builds here: https://nix-on-droid.unboiled.info

Sources:



#2

Can we use nix-env in nixpkgs.bashInteractive ? It seems to hang for me. I got “No such file or directory” error after a couple of seconds.


#3

Yeah, it should work and works for me. Weird. =/

Was it a clean Termux install? Were there any problems during the installation? Does nix work? nix run nixpkgs.hello?