nix icon indicating copy to clipboard operation
nix copied to clipboard

nix shell shebang support doesn't work

Open cdmistman opened this issue 1 year ago • 1 comments

Describe the bug

using nix shell in shebang position as documented doesn't actually work!

Steps To Reproduce

  1. Create a file foo.sh with the following content:
#!/usr/bin/env nix
#! nix shell nixpkgs#bash nixpkgs#hello nixpkgs#cowsay --command bash

hello | cowsay
  1. chmod +x foo.sh
  2. ./foo.sh
  3. Error:
error: './foo.sh' is not a recognised command
Try 'nix --help' for more information.

Expected behavior

Running foo.sh should result in the same output as nix shell nixpkgs#{bash,hello,cowsay} -c bash -c 'hello | cowsay'

nix-env --version output nix-env (Nix) 2.18.1

Priorities

Add :+1: to issues you find important.

cdmistman avatar Feb 20 '24 19:02 cdmistman

nix-env --version output nix-env (Nix) 2.18.1

This feature was only introduced in 2.19.

alois31 avatar Feb 20 '24 19:02 alois31

Prior to 2.19 only the previous nix-shell shebang worked. Closing as answered.

tomberek avatar Feb 26 '24 13:02 tomberek