It's completely illegal unless your home has a "transfer switch" (manual or automatic) installed for this purpose - and if you're plugged into the generator side of a transfer switch, then you can't
charge the truck, only discharge it. There are probably modules designed for solar power that allow two-way transfer safely.
On the other hand there are no tricky rules for an electric truck to have extra power outlets in it.