A 1-ounce serving of walnuts is packed with important nutrients, including protein (4 grams), fiber (2 grams), and magnesium (45 milligrams), which are all important in supporting our immune system and overall health. According to Bazilian, walnuts are also a good source of vitamin B6 (0.2 milligrams per ounce) and an excellent source of copper (0.45 milligrams per ounce), both of which help our immune systems function.