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

--stdin: command not found on v0.6 darwin #35

Closed
howarddo2208 opened this issue May 11, 2023 · 15 comments
Closed

--stdin: command not found on v0.6 darwin #35

howarddo2208 opened this issue May 11, 2023 · 15 comments
Labels
bug Something isn't working MacOS

Comments

@howarddo2208
Copy link

Issue description

I'm trying this plugin out, but ran to an issue upon running nix-shell
Output: /private/tmp/nix-shell-20000-0/rc: line 4: --stdin: command not found
I tried to find the file, it doesn't exist

⚡➜ find /private/tmp/nix-shell*
/private/tmp/nix-shell-10174-0
/private/tmp/nix-shell-10174-0/.attr-0
/private/tmp/nix-shell-10174-0/rc
/private/tmp/nix-shell-10469-0
/private/tmp/nix-shell-10469-0/.attr-0
/private/tmp/nix-shell-10469-0/rc
/private/tmp/nix-shell-10590-0
/private/tmp/nix-shell-10590-0/.attr-0
/private/tmp/nix-shell-10590-0/rc
/private/tmp/nix-shell-10953-0
/private/tmp/nix-shell-10953-0/.attr-0
/private/tmp/nix-shell-10953-0/rc
/private/tmp/nix-shell-11399-0
/private/tmp/nix-shell-11399-0/.attr-0
/private/tmp/nix-shell-11399-0/rc
/private/tmp/nix-shell-93229-0
/private/tmp/nix-shell-93229-0/.attr-0
/private/tmp/nix-shell-93229-0/rc

Did you install the plugin according to the installation guide? If not, does the issue persist if you do install it that way?
Yes, at first, my installation was with zsh-zap, but after that, I changed to plain zsh but still doesn't work

Steps to reproduce

  1. install based on the plain zsh instructions
  2. create shell.nix in a project, i.e
{ pkgs ? import <nixpkgs> {} }:

with pkgs;

mkShell {
  buildInputs = [ cowsay ];
}
  1. run nix-shell

Technical details

Please run the following commands and paste the results:

  1. command nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 22.4.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.15.0`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
  1. zsh --version
    zsh 5.9 (x86_64-apple-darwin22.4.0)
@howarddo2208
Copy link
Author

I changed to 0.5 and it worked again, I think this line leads to the problem on my machine, any input?

NIX_EXECUTING_SHELL=$(readlink /proc/$$/exe) \

@gshpychka
Copy link

gshpychka commented May 12, 2023

Same here. I am on ARM darwin. Running readlink /proc/$$/exe produces no output. I would suggest changing the name of the issue, though, it is confusing right now.

@howarddo2208 howarddo2208 changed the title /private/tmp/nix-shell not found nix-shell not found on v0.6 darwin May 12, 2023
@gshpychka
Copy link

nix-shell not found is not really what's happening, the error is --stdin: command not found

@howarddo2208
Copy link
Author

oh yeah, I figured as I don't see temp nix-shell, I changed to that

@howarddo2208 howarddo2208 changed the title nix-shell not found on v0.6 darwin --stdin: command not found on v0.6 darwin May 12, 2023
@gshpychka
Copy link

gshpychka commented May 15, 2023

So, 0.6 is broken on darwin because there is no /proc on MacOS. @chisui

Would it make sense to simply do which zsh or readlink -f $(which zsh)?

@chisui
Copy link
Owner

chisui commented May 18, 2023

This plugin is developed primarily for use in NixOs. In NixOs you don't have to expose your shell through PATH so which zsh might fail. For Mac support I have to rely on the community since I don't have access to a Mac machine. I will try to find an alternative to /proc for Mac. PRs are more than welcome on this issue though.

@chisui
Copy link
Owner

chisui commented May 18, 2023

@howarddo2208 @gshpychka does ps -p $$ -o command | tail +2 print the path to the currently running zsh? If so I could use that for both Mac and linux.

@gshpychka
Copy link

@howarddo2208 @gshpychka does ps -p $$ -o command | tail +2 print the path to the currently running zsh? If so I could use that for both Mac and linux.

No, it prints "-zsh" on my machine.

@howarddo2208
Copy link
Author

same here
image

@chisui
Copy link
Owner

chisui commented May 18, 2023

An if you use bsd style arguments? ps p $$ o command

@gshpychka
Copy link

An if you use bsd style arguments? ps p $$ o command

That doesn't work: ps: illegal argument: o

How's this:

lsof -p $$ | awk '$4=="txt" {print $9}' | head -n 1 ?

@chisui
Copy link
Owner

chisui commented May 19, 2023

I pushed an potential fix to master. Let me know if that fixes your this issue. If it does, I'll create a new release

@gshpychka
Copy link

Hm, no, same error. I guess the detection logic isn't working as expected?

@chisui
Copy link
Owner

chisui commented May 21, 2023

With the help of a friends Mac I debugged parts of the script. Does the current version on master work now?

@chisui chisui added bug Something isn't working MacOS labels May 21, 2023
@howarddo2208
Copy link
Author

howarddo2208 commented May 21, 2023

yeah, it works now, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working MacOS
Projects
None yet
Development

No branches or pull requests

3 participants