How to buildNpmPackage with Nextjs and Google fonts?

You need to use next local font. Just copy or symlink the font from nixpkgs into your src folder during build time:

If you control the source code chnage it to use local fonts.

Otherwise you could create a patch file to parch the upstream source to use local fonts

And also make sure to set $HOME to eg. $TMPDIR since nextjs tries to write some cache files.