Generalized van der Waals equation for nonequilibrium fluids