Get path to plugin directory

I am looking for the idiomatic lua method to get a plugin’s install path, for example:

~/.config/nvim/<...>/myplugin/
  - lua
    - myplugin
       - myplugin.lua
  - plugin

From myplugin.lua what is the best way to get the path ~/.config/nvim/<...>/myplugin/?

In vimscript I could do something like expand("<sfile>:p:h") but <sfile> doesn’t seem to resolve to anything from lua.

You can get the full path of the myplugin.lua with

debug.getinfo(1).source:sub(2)