Sauté the onion and garlic in butter until soft, about 5 minutes. Add the flour; cook, stirring frequently, over medium heat, about 5 minutes. Whisk in the milk. Add the bay leaves; cook, stirring constantly, over low heat until the mixture thickens, about 20 minutes. Stir in the cheese gradually; cook just until the cheese melts. Remove form heat. Season with salt, pepper, and nutmeg; remove the bay leaves. Stir in the beer.