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.

4 Likes

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.

4 Likes

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.