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

Invoking nix-shell twice results in bash: --stdin: invalid option #28

Closed
ZenithalHourlyRate opened this issue Aug 3, 2021 · 3 comments

Comments

@ZenithalHourlyRate
Copy link
Contributor

Issue description

Did you install the plugin according to the installation guide? If not, does the issue persist if you do install it that way?

According to the installtion guide.

Steps to reproduce

nix-shell -p <whatever>
# inside the nix-shell
nix-shell -p <whatever>

I set -x for these setups, the log is at https://shz.al/R9P6.

Technical details

Please run the following commands and paste the results:

  1. command nix-shell -p nix-info --run "nix-info -m"
  2. zsh --version
$ command nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.47, NixOS, 21.11pre304626.8ecc61c91a5 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.14`
 - channels(zenithal): `"nixpkgs"`
 - channels(root): `"nixos"`
 - channels(rvalue): `"nixpkgs"`
 - channels(gravifer): `""`
 - nixpkgs: `/home/zenithal/.nix-defexpr/channels/nixpkgs`
 
 # zenithal @ Sun in ~ [23:35:02]
$ zsh --version
zsh 5.8 (x86_64-pc-linux-gnu)

Discussion

Seems that

NIX_EXECUTING_SHELL="$SHELL" \

caused the problem as after one nix-shell, $SHELL is set to /home/zenithal/.oh-my-zsh/custom/plugins/nix-shell/scripts/buildShellShim

@ZenithalHourlyRate ZenithalHourlyRate changed the title invoke nix-shell twice invokes bash: --stdin: invalid option Invoking nix-shell twice results in bash: --stdin: invalid option Aug 3, 2021
@chisui
Copy link
Owner

chisui commented Aug 3, 2021

Does the issue persist if you try this branch? https://github.com/chisui/zsh-nix-shell/tree/issue/28

@ZenithalHourlyRate
Copy link
Contributor Author

It works!

BTW, NIX_SHELL_PACKAGES should be concated so I suggest the following change (want a Co-authored-by)

-  local NIX_SHELL_PACKAGES=""
+  local LOCAL_NIX_SHELL_PACKAGES="${NIX_SHELL_PACKAGES}"

and change the variable name in the other places accordingly.

It works for me as follows (with modified zsh-theme)

# zenithal @ Sun in ~ [3:44:01]
$ nix-shell -p nodejs

# zenithal @ Sun in ~ [3:44:07]  { nodejs }
$ nix-shell -p go

# zenithal @ Sun in ~ [3:44:10]  { nodejs go }
$ nix-shell -p mtr

# zenithal @ Sun in ~ [3:44:18]  { nodejs go mtr }
$

@chisui
Copy link
Owner

chisui commented Aug 3, 2021

Ok, I'll merge the change.


The feature request seems like a good idea. If you open a pull-request you'll be listed as a contributor.

@chisui chisui closed this as completed Aug 3, 2021
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