nix-ld icon indicating copy to clipboard operation
nix-ld copied to clipboard

Decouple configuration from activation

Open tobiasBora opened this issue 2 years ago • 2 comments

In order to easily run applications on the system that are not patched (steam-run is not practical at all and integrates poorly with the host system) I set NIX_LD and NIX_LD_LIBRARY_PATH on my whole system. It worked great so far but I don't really like the idea that my system may be less reproducible as nix-ld is now always enabled. So I would love instead if nix-ld could read an environment variable like NIX_ENABLE_FHS that would enable it if it is set. Of course I could manually set NIX_LD_LIBRARY_PATH when I want a shell but it is not as practical to manually specify a huge list of items. Moreover I am also thinking to use this same environment variable to enable other systems like a /bin/bash or other programs (for modularity one could also define another environment variable when one wants to enable only nix_ld but not /bin/bash).

This also have the advantage that if the NIX_ENABLE_FHS is not set, then the user can get a meaningful error explaining that the loader /lib are disabled by default but could easily be enabled (in a quick and dirty way) by setting the above environment variable or by writting a proper derivation. We could also provide more meaningful default values that can run most programs. This way, nix-ld could even be set by default on nixos to provide more helpful help messages.

Do you think it would make sense to integrate this into nix-ld or should I create my own project to test these ideas?

tobiasBora avatar Sep 26 '22 22:09 tobiasBora