  We investigate a class of Leibniz algebroids which are invariant under
diffeomorphisms and symmetries involving collections of closed forms. Under
appropriate assumptions we arrive at a classification which in particular gives
a construction starting from graded Lie algebras. In this case the Leibniz
bracket is a derived bracket and there are higher derived brackets resulting in
an $L_\infty$-structure. The algebroids can be twisted by a non-abelian
cohomology class and we prove that the twisting class is described by a
Maurer-Cartan equation. For compact manifolds we construct a Kuranishi moduli
space of this equation which is shown to be affine algebraic. We explain how
these results are related to exceptional generalized geometry.
