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

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.

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?

Sorry, I forgot to reply to your last post.

Are you still working on this project?

It’s kinda in the ‘works for me’ stage. If you have something you want me to fix, I’ll be happy to look into it.

Thanks.

I tried again and it seems to work with nix-on-droid-install.

I installed a couple of applications with home-manager but I don’t seem to run some of them. I installed tealdeer (tldr) and exa and I get ‘command not found’ when I try to run them.

Where should I report problems? GitHub - nix-community/nix-on-droid-app: Run Nix package manager on Android. Based off Termux the terminal emulator, but not Termux the distro. [maintainer=@t184256] doesn’t seem to have an issue tracker.

1 Like

Report them against GitHub - nix-community/nix-on-droid: Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli] and I’ll definitely take a look this week.

1 Like

I’m not really familiar with the android development ecosystem; how can I install your tool?

(backstory: I’m trying to do some Bluetooth stuff by forwarding USB Bluetooth into a VirtualBox vm for android-x86 (https://www.android-x86.org/) (How to use android emulator for testing bluetooth application? - Stack Overflow), but I’m running into some problems, so I want to install some stuff to see if I can figure something out.)

The link was in the first message:

Oh, does that work for all architectures? I kind of assumed it doesn’t because of the -aarch in the bootstrap folder, but I should have just tried it!

It tells me it failed to install the bootstrap package.

Oh, wow, an x86 request. Nix-on-Droid doesn’t have a x86 bootstrap zip yet, and while it’s not that difficult to create one, I kinda doubt that it’s useful for your particular setup.

You see, most of the magic is there to make it work under regular android app restrictions. Your use case sounds like you don’t care about this at all, you have root and you want to run nix-managed stuff as root, which is possible, but difficult. For you it’s probably better to just try and install nix directly on top of Android, unpacking a Nix tarball into / and executing nix from there, like this person did with guix: Guix on Android! — 2018 — Blog — GNU Guix

The repository you are looking for is GitHub - nix-community/nix-on-droid: Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli], the other one is just the terminal emulator for it.

1 Like

Sweet, thanks for the fast reply! I’ll give it a shot.

Sooo…has anyone gotten the installer linked from Nix & NixOS | Reproducible builds and deployments working on android?

edit: accidentally some words

I don’t suppose there’s some android equivalent of sudo that would make your style of things easy? I don’t know why running nix manager stuff as root on android would be difficult. It’s probably easier for me to use your thing rebuilt for x86 than to figure out how this all works (though that might be inevitable anyway…)

I’m not aware of anything other than Android’s su. You can run su in a fallback session, and then run /…/usr/bin/login as root. But I don’t know any way to become root from within Nix-on-Droid env. If you solve it, let me know in Obtaining superuser privileges from within the Nix environment · Issue #3 · nix-community/nix-on-droid · GitHub

Would you be able to create an x86 build real quick?

I can try to do that today or tomorrow. 32 bit or 64 bit? Can you tell me more precisely what Android x86 image do you run and how?

EDIT: trying to build it now, it’s not as trivial as I thought =(

I’ve built an untested i686 bootstrap, you’re welcome to test it.

1 Like

Hey, thanks! I tried running the apk but it says could not open or something like that. I’ve too much on my plate to work on this today, just leaving a note in case it’s not my fault.

Edit: Oh, running the app that seems to be some sort of installer, worked, results in something like “process exited error code 1”.

I’m on the androidx86 image.

Sorry for being vague, will try to get back to you properly later.

Hello!
I literally signed up here because of your post. I’m -needless to say- interested in reading/hearing anything or Anything you feel comfortable sharing about your journey to get to this (non-Termux environment), along with any advice for someone JUST LIKE YOURSELF, with similar goals.
THANK YOU!
YOU can also reach me at zefon@zefdroid.com, my admin email address.

(sorry for the delay, dang notification went to spam)

There’s not much of a story, I once told it all in 5 minutes:

I tried that a rough prototype worked in proot inside termux: https://github.com/t184256/nix-in-termux

Then threw termux the distro out of the equation: GitHub - nix-community/nix-on-droid: Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]

Then Gerschtli found it and made it into the pretty thing it is today.