Skip to content

Add support to not use the host environment variables #508

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

Closed
elyashivhazan opened this issue Nov 9, 2022 · 3 comments
Closed

Add support to not use the host environment variables #508

elyashivhazan opened this issue Nov 9, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@elyashivhazan
Copy link

elyashivhazan commented Nov 9, 2022

Hi, Im using distrobox for my user space and also for my gamerig (because the host run alpine and I need glib) and I like my games files to be separate from my $HOME, I can change the container $HOME but it is not helping if I have on the host XDG_*_HOME setup. Also Im using distrobox to test apps and build them and its just clutter my home.

It could be solve by adding a env var (for the host) like DBX_HOST_ENV={true,false} and then check it in distrobox-enter.

Im thinking this solution would not work because you need to check that for if I export a program to the host e.g lutris.

@elyashivhazan elyashivhazan added the enhancement New feature or request label Nov 9, 2022
@ilmari-lauhakangas
Copy link

I just got into distrobox today, going to use it for LibreOffice bug triaging as bleeding edge distros can't run old versions. I guess implementing this request would allow me to skip having to say unset XDG_DATA_DIRS before I can run gtk3 apps? For now I added it to the .bash_profile of my custom home dir.

@elyashivhazan
Copy link
Author

elyashivhazan commented Nov 13, 2022

Anyone know how to add this feature? Because my solution isnt working, because you 100% need it for just some boxes and not for all.

@89luca89
Copy link
Owner

Closing in favor of #656

@89luca89 89luca89 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2023
45mg pushed a commit to 45mg/distrobox that referenced this issue Feb 21, 2025
Currently, all host environment variables are copied into the container,
except for a hardcoded few that are ignored:
https://github.com/89luca89/distrobox/blob/3b9f0e8d3d8bd102e1636a22afffafe00777d30b/distrobox-enter#L434

This is not always the desired behavior, particularly on host distros
like NixOS or Guix that break from the FHS and need to set a lot of
environment variables to work around the resulting issues:
89luca89#1516

Therefore, provide a --no-envvars option to disable the default copying
of environment variables, and an --additional-envvars option to copy
specific ones.

It was suggested to use `env -u distrobox` in order to unset specific
environment variables:
89luca89#656
However, there are usually too many copied environment variables to
unset them all individually.
`env -i distrobox` will unset environment variables, but that includes
PATH and other things needed for distrobox to execute correctly on the
host.

Other instances of this feature being requested:
89luca89#508
89luca89#743
89luca89#1173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants