Install on vanilla termux#442
Conversation
It supports symlinks (yay)
The error
/data/data/com.termux/files/nix/bin/sh: error while loading shared libraries: /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so: invalid ELF header
it seems to happen because of
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
which doesn't support the .so file being a linker script
.../files/nix $ cat ./nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf64-littleaarch64)
GROUP ( /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so.6 /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc_nonshared.a AS_NEEDED ( /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/ld-linux-aarch64.so.1 ) )
Flake lock file updates:
• Updated input 'home-manager':
'github:nix-community/home-manager/4de84265d7ec7634a69ba75028696d74de9a44a7?narHash=sha256-DVv6nd9FQBbMWbOmhq0KVqmlc3y3FMSYl49UXmMcO%2B0%3D' (2024-03-03)
→ 'github:nix-community/home-manager/a9953635d7f34e7358d5189751110f87e3ac17da?narHash=sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A%3D' (2024-11-24)
• Updated input 'nix-formatter-pack':
'github:Gerschtli/nix-formatter-pack/2de39dedd79aab14c01b9e2934842051a160ffa5?narHash=sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c%3D' (2024-01-14)
→ 'github:Gerschtli/nix-formatter-pack/9f4bcf647cad2edafda7e1143071e0daf37cbc41?narHash=sha256-TxJ7RZLlBkKWZos1ai3eWIH0fBq1G6SVE%2Bq3dW%2B0qRU%3D' (2024-10-20)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/5d874ac46894c896119bce68e758e9e80bdb28f1?narHash=sha256-3M94oln0b61m3dUmLyECCA9hYAHXZEszM4saE3CmQO4%3D' (2024-02-17)
→ 'github:NixOS/nixpkgs/69661586d1c9d85e859887d95285f6fc92521657?narHash=sha256-BWzlDJpfcE7DgxtAkeXHnU69Iz6cU64yCgE6b%2Bhqds8%3D' (2024-11-26)
• Updated input 'nixpkgs-docs':
'github:NixOS/nixpkgs/9a333eaa80901efe01df07eade2c16d183761fa3?narHash=sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY%3D' (2024-01-22)
→ follows 'nixpkgs'
|
Quick question: what's the benefit of doing all of that over [nix-in-termux](https://github.com/t184256/nix-in-termux)?
|
|
Hi @t184256 , I explained the reasons here: #257 (comment) Today it is VERY difficult to install nix on termux and it is manual/not automated, so we need to have this bootstrap zip hosted on the web server with the current release pipeline. Then one can even package the installation up as a Termux package: |
|
Hi @t184256 , I explained the reasons here: #257 (comment)
No, this is about "why use nix-on-droid and Nix on Android in general".
Today it is VERY difficult to install nix on termux and it is manual/not automated,
And I've linked to a project automating that with much fewer code than nix-on-droid.
so we need to have this bootstrap zip hosted on the web server with the current release pipeline. Then one can even package the installation up as a Termux package: `$ pkg install nix-on-droid`
Sorry, I see 0 connection between bootstrap zips and termux debs. Why have the first if you can build the second?
|
|
HI again @t184256 , I'm aware half of the development is proper communication & I try. Probably the best methodology/result is actually providing the changes that will make it more clear what specific changes I want. My first 4 points explain the reasons why nix on termux instead of a - Nix-on-droid app uses a fork of Termux which backtracks new features, changes & fixes to current Termux, if it ever gets these changes. |
|
Yeah, something seems broken with our communication here, but that's fine =) Let me try again: You seem to be answering "why would one want to forego nix-on-droid Termux fork app and use Termux with Nix installed inside it". Later on I've decided I don't use Termux other than for installing Nix and started a different project, nix-on-droid, that skips right past the Termux part and bootstraps from my entirely Nix-built zipball. Would be cool if Termux app allowed me to specify an url and do a couple more things differently wrt discovering the entry point. It didn't, so I forked it under nix-on-droid-app. Without me using it, nix-in-termux got archived. Six years later, you send a pull request to nix-on-droid, a project that's now easily 10x the size of nix-in-termux, that (to the best of my understanding, sorry if I understood something wrong here) does a very roundabout thing: uses this monstrosity, effectively, as an archive with Nix inside it, so that you can unpack it into your Termux environment and enjoy using Nix from there. As I said, a valid goal in itself, except there's one thing I totally do not understand. There already exists an archive with Nix and all the required dependencies inside it that one can unpack and use, an official Nix release tarball. A tarball that nix-on-droid uses as a starting point for its zipball. A tarball that nix-in-termux downloads and unpacks. Half of the script is downloading it and unpacking it. Half of the script is prooting into the resulting environment. That's literally all to it. You can just do the same, maybe fork my nix-in-termux repo, update the urls/hashes and maintain it in its 50 SLOC glory. Unless I'm missing something? Instead you file a pull request to nix-on-droid, a much larger project with an established userbase, to make it suit your needs, one that'd render their installs broken. With no tests, no upgrade paths, no nothing. To do what a much simpler nix-in-termux did? Hope that clarifies my confusion about your request: I'm not asking "why would one prefer to go the nix-in-termux way'. I'm asking "why this PR to nix-on-droid instead of reviving nix-in-termux"? Or doing that thing you've proposed with packaging nix as part of Termux. That sounds neat. |
|
@t184256 Thanks for the very good explanation! This PR is not finished as you correctly pointed out it doesnt even include any tests or finished solution also I certainly appreciate & respect your solution when it comes installing nix on android devices.
I tried the 50LOC script and it didnt work for me yesterday, dont remember the specific error unfortunately but I really tried building this with that script, with my fork with changes etc. Only these changes worked.
I did precisely that, it didn't work. So I had to manually compile the bootstrap zip myself and wait hours of compilation and unpack it to my android device. Thus I suggest streamlining this process by adding a termux zip/tar to the release/web server pipeline.
I also suggest removal of the nix-on-droid android app/simplifying/removing a lot of code here. I come from Ruby background where we had tons of ways to solve a problem, later in my life I realized its is MUCH better solution to remove code from a system whenever possible and support the best solution more and potentially remove the curse of choice for others. Thus I also suggest that we endorse "nix-in-termux" approach more, but thats of course up to you. I know PR is still incomplete, let me know if you'd like me to have a look for the right needed changes. I'll probably get back to this PR but it might take few days/weeks. Thanks again for this awesome solution! I just think it can be better 🙏 |
This PR is incomplete, instead we should create another bootstrap zip for termux specifically so we can continue to respect existing nix-on-droid-app code contract. This new bootstrap zip should be hosted on the http file server so people dont need to cross-compile and automate the process by simply executing a bash script on their Termux device.
I created a PR here to show you @t184256 the only working bootstrap zip for termux, after 2+ hours of manual cross-compilation from my machine to scp it and set it up on the android device: