In a dry pan, roast walnuts over medium heat until aromatic (about 3-4 minutes).
In a pot, heat sugar and 2 tablespoons of water over medium heat. When it starts to boil, lower the heat and add chopped rosemary and cayenne pepper. Remove from the heat, dd walnuts, salt and black pepper (if using) and stir until walnuts are evenly coated with a think layer of caramel mixture. Transfer to a sheet of baking paper and let cool. Enjoy!
Store in an airtight container in a cool and dry place for up to 2 weeks.