Does eating nuts when I'm pregnant give my baby a nut allergy or prevent my baby from having nut allergies?

Depends on history. The jury is still out on that question. There is some evidence that family ingestion of peanuts is associated with peanut allergy, but that doesn't apply to prenatal exposure in general, dietary restrictions during pregnancy are not recommended to prevent allergies.