How to make a nix file which returns a derivation into an executable file?

You can also achieve this without a wrapper, but I wouldn’t recommend it, as it’s not officially supported and probably won’t remain stable.

There was some exploration in this direction (including some positively disgusting shebangs) in this thread: