News for hackers. Stuff that matters.
Re:On env Shebangs by abathur on Friday April 15, 2022 @11:19PM (#31049096)
I came here to say this, too :)

But, of course, it isn't a silver bullet...

1. You still have to have a sane PATH. A fair amount of the Nix install-related issues that get opened are PATH problems, and you can also run into problems with PATH in cron/launchd (as @tyingq noted).

2. You still have to know what the script depends on. This can get tricky beyond small scripts you wrote yourself. (I write a tool for discovering and ~linking/resolving external dependencies in Shell scripts, https://github.com/abathur/resholve. As I've been working on converting some of nixpkgs' existing Shell packages to use it, I almost always find dependencies the initial packager missed.)

Re:On env Shebangs by Filligree on Saturday April 16, 2022 @04:05AM (#31050563)
Re. 2-

If you invoke nix-shell with --pure, then it'll erase most user state — PATH included — prior to invoking the script. I don't find much use for this, but it would be useful to ensure nothing that isn't an explicit dependency gets used.

Re:On env Shebangs by abathur on Saturday April 16, 2022 @08:56AM (#31051934)
Yes, `--pure` helps (and `env -i` can also help) but that's not the hard part of finding them all. It only really helps when there's no conditional logic or no options that can lead to the execution of different programs.