I start almost all my scripts lately with
#!/usr/bin/env nix-shell
#! nix-shell -i bash
set -e
But this requires that the default.nix/shell.nix be in the same directory as the script which is not always the case. Is there a way to tell nix-shell to look at all parent directories for a *.nix file?
The items after
#! nix-shellare basically regularnix-shellarguments, so you can add the file name like this.Path resolution happens relative to the script file. When you use a directory path, it will look for
default.nix, notshell.nixinside the directory.