How to use gh with extensions?

I have add pkgs.gh in my nix-darwin config. It works as expect, but when I run

gh copilot

It returns:

failed to run extension: fork/exec /Users/nada/.local/share/gh/extensions/gh-copilot/gh-copilot: no such file or directory

Usually to find out which package contains a binary (/bin/gh-copilot) you can use nix-locate but since in this case the package is unfree it’s not indexed.

Anyway in this case the package name was easy i.e. gh-copilot.
Notice that since it’s unfree evaluation will fail by default, check here how to do.