Runtime alternative to `patchelf --set-interpreter`

It is exactly the problem.
Path to is inside /nix/store and difficult to guess.
That means the calling side must go through Nix build process in order to get path to and then to preserve it from GC. Also the calling side must be rebuild on glibc (’s owner) upgrade.
All these are difficult to do when the calling side is a jar file downloaded from Maven Central to $HOME/.m2

I just got exactly the same issue with a maven dependency (GitHub - flapdoodle-oss/de.flapdoodle.embed.mongo: ...will provide a platform neutral way for running mongodb in unittests.) and was very happy to find this trick… thanks @volth ! :slight_smile:

I hit the problem of mvn downloading and running pre-built ELF files today and made it work by wrapping mvn with proot: global-platform-pro: 18.09.14 -> 20.01.23 by bjornfor · Pull Request #250228 · NixOS/nixpkgs · GitHub

Can GitHub - Mic92/nix-ld: Run unpatched dynamic binaries on NixOS help?