A classical principle in deformation theory asserts that any formal deformation problem over a field of characteristic zero is classified by a differential graded Lie algebra. This principle has been described more precisely by Lurie and Pridham, who establish an equivalence between dg-Lie algebras and formal moduli problems indexed by Artin commutative dg-algebras. I will discuss an extension of this result to more general pairs of Koszul dual operads over a field of characteristic zero. For example, there is an equivalence of infinity-categories between pre-Lie algebras and formal moduli problems indexed by permutative algebras. Under this equivalence, permutative deformations of a trivial algebra are classified by the usual pre-Lie structure on its deformation complex. In the case of the coloured operad for nonunital operads, a relative version of Koszul duality yields an equivalence between nonunital operads and certain kinds of operadic formal moduli problems. This is joint work with D. Calaque and R. Campos.