Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple configuration from activation #29

Open
tobiasBora opened this issue Sep 26, 2022 · 2 comments
Open

Decouple configuration from activation #29

tobiasBora opened this issue Sep 26, 2022 · 2 comments

Comments

@tobiasBora
Copy link

tobiasBora commented Sep 26, 2022

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?

@Mic92
Copy link
Member

Mic92 commented Nov 4, 2022

How about a bash/zsh function that sources NIX_LD and NIX_LD_LIBRARY_PATH on demand?

@tobiasBora
Copy link
Author

tobiasBora commented Nov 19, 2022

Sounds great as it avoids breaking existing stuff, and it seems quite flexible (we could fetch the data the first time the user uses the command, provide various "profiles" depending on the apps to install…). Just it may be a bit annoying to write one function for every shell (there are many more shells than zsh and bash), but we can certainly eithen start a new shell like nix-shell to populate the variables and drop the user in it's wanted shell after (just if a user wants to enable it in it's .bashrc/.profile it would not work ), or additionally provide values in NIX_LD_DEFAULT so that one can just write a few export NIX_LD=NIX_LD_DEFAULT if needed. Or explicitely ask the user to pipe the output to exec or alike, providing multiple options depending on the shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants