In this work, we present a family of layer-averaged models for the Navier-Stokes equations. For its derivation, we consider a layerwise linear vertical profile for the horizontal velocity component. As a particular case, we also obtain layer-averaged models with the common layerwise constant approximation of the horizontal velocity. The approximation of the derivatives of the velocity components is set by following the theory of distributions to account for the discontinuities at the internal interfaces. Several models has been proposed, depending on the order of approximation of an asymptotic analysis respect to the shallowness parameter. Then, we obtain a hydrostatic model with vertical viscous effects, a hydrostatic model where the pressure depends on the stress tensor, and fully non-hydrostatic models, with a complex rheology. It is remarkable that the proposed models generalize plenty of previous models in the literature. Furthermore, all of them satisfy an exact dissipative energy balance. We also propose a model that is second-order accurate in the vertical direction thanks to a correction of the shear stress approximation. Finally, we show how effective the layerwise linear approach is to notably improve, with respect to the layerwise constant method, the approximation of the velocity profile for some geophysical flows. Namely, a Newtonian fluid and some complex viscoplastic (dry granular and Herschel-Bulkley) materials are considered.