-
Notifications
You must be signed in to change notification settings - Fork 0
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
Environment which sets PATH may break #12
Comments
This is strange. The Nix Flake already has
Have you collected garbage so your Nix store no longer has the
|
Well, of course it is strange. #! /nix/store/mm0pa3z7kk6jh1i9rkxqxjqmd8h1qpxf-bash-5.2p37/bin/bash -e
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/wj603ds3b3gdwsrlx4nzcg4v3ba2298b-jq-1.7.1-bin/bin'':'/':'}
PATH='/nix/store/wj603ds3b3gdwsrlx4nzcg4v3ba2298b-jq-1.7.1-bin/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/13wxcn0j2wk911ahfkbvdq241rkprsv8-gnused-4.9/bin'':'/':'}
PATH='/nix/store/13wxcn0j2wk911ahfkbvdq241rkprsv8-gnused-4.9/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/sf6y4arqcm100rnnl3dhpg732i774zp6-coreutils-9.5/bin'':'/':'}
PATH='/nix/store/sf6y4arqcm100rnnl3dhpg732i774zp6-coreutils-9.5/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
exec -a "$0" "/nix/store/53c32nsxkj4gk0p306yzd6hzdnmm93w2-bash-env-json-0.9.1/bin/.bash-env-json-wrapped" "$@" Because I manually went to I don't know if you tried to reproduce the issue by running If it really missed jq in path then it wouldn't work on other files too right? Because I assume that jq is used every time when bash-env-json is used. Instead it just fails on this particular file with the jq is missing error and when used on other files it works perfectly. And I am sure jq doesn't go on vacation and refuse to process this file in prticular. Weird I know, that's why I tried your flake package too, to make sure that it wasn't a problem with my package. If you aren't able to reproduce the issue then I will try to run it on different NixOS machines. I suspect that because those file contents manipulate PATH it might actually affect the PATH of Edit: export PATH="$HOME/.nix-profile/bin:${XDG_STATE_HOME}/nix/profile/bin:$HOME/.local/state/nix/profile/bin:/etc/profiles/per-user/$USER/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" was the culprit, commenting it out makes everything work. |
Ah, I understand what's wrong, and I know how to fix it. That file sets PATH to be something very minimal which doesn't have The solution will be to not wrap the script with path setting, but instead access I can fix this shortly. I used to do such a thing previously before I introduced the wrapping thing. Thanks for reporting! |
Minimal example:
|
OK @jaredmontoya this is fixed.
I just want to add some tests for the Nix packaging before I merge that PR, but this should unblock you. 😄 |
Quicker than expected with the tests, is merged and tagged 0.9.2. Enjoy! |
everything works as expected when I run bash-env-json on
/etc/profiles/per-user/nix/etc/profile.d/hm-session-vars.sh
but it fails when I run it on
/nix/store/qalsdzij4y0xgrawdn5nndjvp0mgqm1d-set-environment
with
bash-env-json /nix/store/qalsdzij4y0xgrawdn5nndjvp0mgqm1d-set-environment
or
cat /nix/store/qalsdzij4y0xgrawdn5nndjvp0mgqm1d-set-environment | bash-env-json
I tried both, the flake package and my package: NixOS/nixpkgs#358140
both failed like this:
flake package:
nixpkgs package:
/nix/store/qalsdzij4y0xgrawdn5nndjvp0mgqm1d-set-environment
is responsible forenvironment.sessionVariables
attrset in NixOS configuration.Even without using bash-env on the file, environment variables from it are available in nushell when it is used as a login shell(so it is not because the parent user shell provided the environment), but I still think the fact that bash-env can't parse it might be an issue if it turns out that there is another script that needs to be sourced but bash-env doesn't work on it.
contents of
/nix/store/qalsdzij4y0xgrawdn5nndjvp0mgqm1d-set-environment
:The text was updated successfully, but these errors were encountered: