On present-day Earth, that hairstyle is very difficult to maintain:
The iconic if ludicrous hairdo—Carrie Fisher, who starred as Leia, herself mocked it as “cinnamon buns”—took two hours to style and secure, and even then, it was dodgy. “I was a little afraid of it,” Fisher told The Making of Star Wars author J.W. Rinzler. “I was afraid my hair was going to fall off.” (source)
Yet, Fisher, as Leia, kept the hairstyle all through the events of the first movie, despite her being trapped in prison, locked in a trash compacter, and involved in battle, among other things. Her other hairstyles in the other movies, and other grooming traits - i.e. lipstick and makeup - remained unaffected as well.
I understand that it's a movie and George Lucas wanted Carrie Fisher to look her best. But is there an in-universe reason how the hairstyle stayed perfect throughout the events of the first movie? Does the Star Wars universe have some sort of self-grooming tech?
(Inspired by this quote on Mental Floss:
“When would revolutionaries find the time to put your hair up in two ridiculous buns, which are impossible, even with modern state-of-the-art hair product technology to carry for any length of time, if indeed you manage to tame your hair enough to play along to begin with.” )