Generalized surface thermodynamics with application to nucleation