Michel Bastos had an effort on goal after six minutes, but his shot was well-blocked by an alert defence.
Lisandro Lopez drove forward for the away side on 23 minutes, but his finish was wide of the target.
Nivet had a chance to grab a second on 51 minutes, but his shot went just wide of the post.
Lopez came close for Lyon on 57 minutes, though his strike was off target as Les Gones pushed forward to try and restore their lead.
Lyon did get back in front after 75 minutes through young defender Samuel Umtiti, who was on target to make it 2-1.
Troyes pushed forward in hope of a late equaliser, but Lyon stood firm to secure all three points.