Place butter in a small saucepan over medium-low heat; cook until butter melts, stirring occasionally. Add onion to pan; cook 10 minutes or until tender (do not brown), stirring occasionally. Sprinkle flour over onion; cook 2 minutes, stirring occasionally.
Gradually add milk to flour mixture, stirring with a whisk until smooth; bring to a simmer. Simmer 10 minutes or until thickened, stirring frequently. Strain mixture through a fine sieve over a bowl; discard solids.
Stir in salt, pepper, and nutmeg, if desired.
Wipe pan clean with paper towels. Return sauce to pan, and place over medium-low heat. Add Gruyère cheese, stirring until smooth. Serve immediately.