My goal is simple: I would like to create a program that bootstraps the nix package manager on any architecture, as a non-root user, with as few depends as possible. For now, what I did is the following: I download on the host a minimalist alpine version, with the good arch. Then I untar it, and "chroot" (in fact proot) into it. Then, I install (in the chroot) all the deps for the build, I build it with the good options, and then I copy back the files on the host.
But there is an important problem: each system seems to have the "interpreter file" (the thing you get when you run
file on it) in a different place: on my debian it's in
/lib64/ld-linux-x86-64.so.2, but on alpine it's in
/lib/ld-musl-x86_64.so.1. So when I run it, I get an error like
File does not exists (while it obviously exist).
So here is my question: how can I compile a tool (like nix), so that the interpreter is sure to be found on all (or at least most) of the linux distributions ? And if it's not possible, can I, somehow chroot/proot into a system, and use the host interpreter, so that when I copy back the files on the host the interpreter becomes the good one ?