Lawmakers agree on $8 billion school-funding package