We analyse the geometry of generic Minkowski mathcal{N} = 1, D = 4 flux compactifications in string theory, the default backgrounds for string model building. In M-theory they are the natural string theoretic extensions of G2 holonomy manifolds. In type II theories, they extend the notion of Calabi-Yau geometry and include the class of flux backgrounds based on generalised complex structures first considered by Graña et al. (GMPT). Using E7(7) × ℝ+ generalised geometry we show that these compactifications are characterised by an SU(7) ⊂ E7(7) structure defining an involutive subbundle of the generalised tangent space, and with a vanishing moment map, corresponding to the action of the diffeomorphism and gauge symmetries of the theory. The Kähler potential on the space of structures defines a natural extension of Hitchin’s G2 functional. Using this framework we are able to count, for the first time, the massless scalar moduli of GMPT solutions in terms of generalised geometry cohomology groups. It also provides an intriguing new perspective on the existence of G2 manifolds, suggesting possible connections to Geometrical Invariant Theory and stability.