After weeks of disagreement, lawmakers finally settle on $1 trillion spending bill to fund the government