Statistical mechanics of hyperuniform materials and particle packings