nix-community / nix-on-droid

Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]
https://nix-on-droid.unboiled.info
MIT License
1.15k stars 65 forks source link

Allow changing bootstrap filename for 32-bit userland 64-bit kernel devices (ie cheap Samsung) #282

Open unjordy opened 11 months ago

unjordy commented 11 months ago

nix-on-droid seems to work fine on low-memory (4 GB and under) Samsung devices which ship with an aarch64 CPU and kernel but an armv8l userland. The only inconvenience is that bootstrap-aarch64.zip has to be hosted on a web server with https and a valid certificate (or a desktop with an ngrok tunnel running) as bootstrap-arm.zip. Is it possible to provide a configuration option to change the path these devices look for (along with a strong warning stating that this'll only work if you're sure you're in this type of environment)?

Here's some screenshots of nix-on-droid running on my 2019 Samsung Galaxy Tab A 10.1" under lineageOS 20.0 (note the architecture returned by uname and neofetch):

Screenshot_20230803-161332_Nix Screenshot_20230803-164844_Nix Screenshot_20230803-183123_Nix

t184256 commented 11 months ago

Is it possible to work around that easier by entering the path to a local file?

t184256 commented 11 months ago

Your screenshots show the kernel reporting itself as armv8l. How should the app determine that 64-bit userland will work?

unjordy commented 11 months ago

How should the app determine that 64-bit userland will work?

It probably shouldn't. I think a local path would work fine for edge case devices like these, but I didn't see any indication that specifying a local path would work (ie README.md states that a custom bootstrap needs to be hosted on an HTTP server somewhere), and the error I got the one time I tried didn't inspire any confidence to try it again.

Though if detecting these devices in the app is desired, seeing if the device can run the statically linked proot or shipping a statically linked 64-bit GNU hello or something similarly tiny and seeing if that runs would work. If either program gives a successful exit code even though the kernel is armv8l, then we know we're on a device that can run 64-bit binaries in spite of what architecture is being reported.

izelnakri commented 9 months ago

I had the exact same aarch64 vs armv8l problem for my VITURE Neckband and thank you @unjordy for the ngrok tunnel idea. I'm trying it out now.

We should definitely allow developers to customize that aarch64 auto-assignment

izelnakri commented 9 months ago

@t184256 I've successfully installed nix-on-droid on my viture neckband after waiting about ~15 minutes on activationPackage, I guess here: https://github.com/nix-community/nix-on-droid/blob/master/modules/build/activation.nix#L150

Anyway we can make nix config cores = 0 during installation if it isn't already parallel?

Apart from the long installation time(neckband itself should be fast 4x@2ghz CPU), I had one ignored error that happened twice. I wish I could take screenshots but basically:

error (ignored): error: getting status of /sys/fs/cgroup/cpu.max: Permission denied

Also currently I cannot run nix upgrade-nix, installation nix version is 2.13.5. I was able to install v2.17 with pkgs.nixVersions.nix_2_17.

t184256 commented 1 week ago

Is it possible to work around that easier by entering the path to a local file?

Actually, yes, file:///path/to/directory/containing/bootstrap/zipballs does work.