This question of how to fit a sum Gaussians, where the number of Gaussians is to be determined, to data is answered nicely already by Fittting data with combination of an unknown number of Gaussians, but including constraints seems difficult. Here is an attempt:
g[x_, xo_, σ_, a_] := {a Exp[-((x - xo)^2/(2 σ^2))]/(σ Sqrt[2 π]), a > 0}
When running the code at the link with this change get the following error:
NonlinearModelFit::eqineq: Constraints in {(a[1]>0)+(a[2]>0)} are not all equality or inequality constraints. With the exception of integer domain constraints for linear programming, domain constraints or constraints with Unequal (!=) are not supported.
How to add constraints?