Dimensional reduction of the heterotic string over nearly-Kähler manifolds