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

Wrapped nix-shell binary breaks Nix shell shebang #4

Open
campbellcole opened this issue Jul 3, 2024 · 1 comment
Open

Wrapped nix-shell binary breaks Nix shell shebang #4

campbellcole opened this issue Jul 3, 2024 · 1 comment

Comments

@campbellcole
Copy link

Any script that uses the nix-shell shebang when nix.monitored.enable = true; is interpreted as a Nix expression instead of the chosen interpreter.

For example, the following script:

#! /usr/bin/env nix-shell
#! nix-shell -i bash -p inotify-tools

echo "test"

produces the following error:

error: undefined variable 'echo'

       at /fake/path/example.sh:4:1:

            3|
            4| echo "test"
             | ^
            5|

With the nix-monitored module enabled, is there any built-in way to access the original nix-shell binary? Perhaps this could be worked around by providing a nix-shell-unwrapped binary in the path (if that isn't already a thing).

Thanks

@campbellcole
Copy link
Author

I just found a workaround. Using the flake shebang still works, so I just replaced my shebang with:

#! /usr/bin/env -S nix shell nixpkgs#inotify-tools --command bash

# ...

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

1 participant