A new explicit Lyapunov function allows to study the exponential stability for a class of physical 2 by 2 hyperbolic systems with nonuniform steady states. In fluid dynamics, this class of systems involves isentropic Euler equations and Saint-Venant equations. The proposed quadratic Lyapunov function allows to analyze the local exponential stability of the system equilibria for suitable dissipative Dirichlet boundary conditions without additional conditions on the system parameters.