While it may seem trivial to make a battery holder, it turned out to be much harder than I thought. As I haven't finished my 3D printer yet, my options for building one were limited. And commercially available 18650 cell holders weren't going to cut it in the high-vibration environment of a mountain bike.
First I tried making one out of MDF as a test, using a spade drill bit to drill out some 19mm holes for the cells. But I didn't have any material to build a proper one out of.
Eventually I decided to make it out of electrical PVC conduit pieces glued together, with foam-supported battery terminals on the ends. There's 17 slots but one will be empty.