Do NOT get the XX1 for e-bike usage. Get the X01, it is sturdier.
You just need the derailleur, shifter and a 12-speed casette. If your bike has one, just use that one. If you don't have a 12 speed yet, get one that fits on your hub - they are available for XD and Shimano hubs. I would get an...