Fit multiple peaks with shared parameters

Dear @jonas , would this code also work for a non constant background, e.g. a linear background? Could I just redefine bkg1 as a RooFormulaVar? because then, for the background of the second peak, it would just be a constant if I understand well?