How is `@bash@` expanded in nixpkgs?

I’m looking into some ShellCheck issues, and I’ve found some weird shebang lines like #! @bash@/bin/sh. How/where are these being expanded?

1 Like

For the linked file:

For other occurences of any “templates” you will find where they are “rendered” on your own. Though usually they are close.


Ah, I missed substituteAll. Looks like it takes a src and then uses … the name of everything in scope to figure out what to substitute? Not the easiest code to follow, as it seems the actual substitution is at least two levels removed from it.


Yeah, I always found that pattern annoying, surprising, and unnecessarily hard to read and work with. These days we have writeShellApplication, which would just set $PATH appropriately.