Using petsc4py.PETSc.SNES directly

This isn’t exactly what you need, but you can use it to figure out how to do it in old dolfin.

Using a PETSc SNES directly with dolfinx here. This shows how to set up the SNES.

The class to interface with the SNES solver here. Should be very similar to the old dolfin custom nonlinear problem that you linked to.