Next.js has a limited set of possible pages-directories, either pages or src/pages. This is not going to change in the future, as mentioned here.
In some cases it is necessary or helpful to have a custom pages-directory.
These two snippets make it possible:
Monkey-patches findPagesDir inside of next to check for the custom pages-directory at RELATIVE_CUSTOM_PAGES_PATH.