Because I just had 10mm x 10mm x 4mm magnets at home, I edited Dragongars nice work to fit my magnets.
Because these magnets are rectangular, a separate lid is not needed anymore. I modelled it directly onto the box.
I recommend to glue the magnets into the holes with a very strong compound glue.
I'd print with 100% infill since it needs to be strong.