-
Notifications
You must be signed in to change notification settings - Fork 330
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
Bloated environment variables with 1.0 #1084
Comments
We know about this and originally the naked shell existed just to improve bloated environment. We reverted back to how Nix works, because unfortunately it broke too many things. There's #1069 that removes more variables, feel free to explore if we can remove more of those. |
The absence of the following variables broke our setup: devenv/src/modules/mkNakedShell.nix Lines 102 to 109 in c81069c
on top of the specific compiler flags, that would force the wrong one in many cases. One example is the Rust service integration - on Darwin it depends on libiconv, but that is no longer added to any searchable path (LD_LIBRARY_PATH which used to point to DEVENV_PROFILE/lib). Not sure what the end goal is here, but would it make sense to have the integration specify which variables it needs (seeing that we cannot distinguish derivation build state from env vars)? |
Just a quick update - for reference, I updated our for env in shellHook AR AR_FOR_BUILD AS AS_FOR_BUILD CC CC_FOR_BUILD CONFIG_SHELL CXX \
CXX_FOR_BUILD DETERMINISTIC_BUILD DEVENV_RUNTIME GETTEXTDATADIRS_FOR_BUILD LD \
LD_DYLD_PATH LD_FOR_BUILD MACOSX_DEPLOYMENT_TARGET NIX_BINTOOLS \
NIX_BINTOOLS_FOR_BUILD NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_apple_darwin \
NIX_BINTOOLS_WRAPPER_TARGET_HOST_aarch64_unknown_linux_gnu \
NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_apple_darwin \
NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_CC \
NIX_CC_FOR_BUILD NIX_CC_WRAPPER_TARGET_BUILD_x86_64_apple_darwin \
NIX_CC_WRAPPER_TARGET_HOST_aarch64_unknown_linux_gnu \
NIX_CC_WRAPPER_TARGET_HOST_x86_64_apple_darwin \
NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_CFLAGS_COMPILE \
NIX_CFLAGS_COMPILE_FOR_BUILD NIX_COREFOUNDATION_RPATH NIX_DONT_SET_RPATH \
NIX_DONT_SET_RPATH_FOR_BUILD NIX_ENFORCE_NO_NATIVE NIX_HARDENING_ENABLE \
NIX_IGNORE_LD_THROUGH_GCC NIX_LDFLAGS NIX_LDFLAGS_FOR_BUILD NIX_NO_SELF_RPATH \
NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_apple_darwin NIX_STORE NM NM_FOR_BUILD \
NODE_PATH OBJCOPY OBJDUMP PATH_LOCALE PKG_CONFIG PYTHONHASHSEED PYTHONNOUSERSITE \
PYTHONPATH RANLIB RANLIB_FOR_BUILD READELF SIZE SIZE_FOR_BUILD SOURCE_DATE_EPOCH \
STRINGS STRINGS_FOR_BUILD STRIP STRIP_FOR_BUILD WINDRES ZERO_AR_DATE \
__darwinAllowLocalNetworking __impureHostDeps __propagatedImpureHostDeps \
__propagatedSandboxProfile __sandboxProfile cmakeFlags configureFlags \
dontAddDisableDepTrack mesonFlags system; do
unset $env;
done
export PKG_CONFIG_PATH="$DEVENV_PROFILE/lib/pkgconfig:''${PKG_CONFIG_PATH-}"
export LD_LIBRARY_PATH="$DEVENV_PROFILE/lib:''${LD_LIBRARY_PATH-}"
export LIBRARY_PATH="$DEVENV_PROFILE/lib:''${LIBRARY_PATH-}"
export C_INCLUDE_PATH="$DEVENV_PROFILE/include:''${C_INCLUDE_PATH-}"
export XDG_DATA_DIRS="$DEVENV_PROFILE/share:''${XDG_DATA_DIRS-}"
export XDG_CONFIG_DIRS="$DEVENV_PROFILE/etc/xdg:''${XDG_CONFIG_DIRS-}" to get back the behavior we were expecting. In case anyone else gets into the same situation. On the topic of |
@martinjlowm can you provide a minimal example of how to reproduce this issue in a separate issue? I'll find a way to fix it. |
If this is about macOS specifically, i.e. using gcc instead of clang, then that was fixed in #1162.
Do you have an example to show us where this breaks? This might also be related to #1162.
With 1.0, we're back to the full Nix shell. Libraries are not added to
Perhaps. But we have to be careful here, and remove with intent and a complete understanding of what the variable does. |
Describe the bug
With the introduction of cf9d122 the new way of setting up the development shell introduces a lot of new variables, ones that were not there with the naked shell. I'm seeing 5x times the amount of variables being set, some of which are compiler-related variables, AR, CC, CXX etc. which forces which compiler anything in the project uses.
That same commit introduced
unsetEnvVars
, but that seems like a lot of work to maintain (which is actually only used if you don't overrideenterShell
).I'm sure at least some of the changes were intentional, but at least this part is a worse user experience than what we had before.
To reproduce
Pin the Flake input to a commit newer than the aforementioned, e.g. 1909832
Before
After
Version
1.0.2
The text was updated successfully, but these errors were encountered: