I bought a sunroof off of eBay. It may actually have been just a regular window from a camper. I can't remember.
But, anyway, the sunroof has a "rim" around the outside of it. So I built up an area between two of the roof spars to accept the sunroof.
When I built the roof, I placed two of the spars just the right distance apart to accept the window. Then I placed two braces between those spars where the ends of the sunroof would be.
After I got the sheathing on the roof, I cut out the opening for the sunroof and "dropped it in". I then drilled holes through the rim of the sunroof and used stainless steel screws to screw it into place. I also used a polyurethan sealer under the rim of the window to make sure it was going to be waterproof.
Now there was more to it than that, naturally. You can see pics from this in my build log here:
http://webpages.charter.net/outtahand/littletow/build18.htmIt really adds a lot to be able to look out at night. Makes it a lot less claustrophobic inside. But you will want some kind of curtain for it. Sun coming through can really heat up the interior!