Recently, I made a guitar pick box with a pivoting lid. I used a pair of 3/8"-diameter rare earth magnets to create the pivot hinge. To install the magnets, I drilled a hole down through the lid and just far enough into the box edge to seat two-thirds of the thickness of one of the magnets. I glued one magnet into this stopped hole in the box. Then, I inserted the other magnet into the hole in the lid until it mated with the fixed magnet. A dab of glue locked this top magnet in place in the lid, followed by a little mother-of-pearl disk to hide it. Since the bottom magnet protrudes slightly from the box, it nests in the lid hole to keep it perfectly aligned. The two magnets are strong enough to hold the lid in place while pivoting.