Should I carpet the stairs or install hardwood flooring first?
Generally carpet is self edging,while hardwood floors are not (they usually gap from the wall a bit and call for a molding over the edge).  

Install the floor and leave the gap at the first riser, without a molding, and bring the carpet down the riser and blind edge it.  You can easily undo it in the future.  This would allow you to replace the carpet, as Tester101 says, or to shift back to no carpet. Just add molding.