To choose a suitable enclosure my first thoughts were to flush-mount the system in a standard single gang electrical box, with just the pulley exposed on the face of a suitably drilled blanking plate. This won't work for a couple of reasons. 1) The motor is too deep for a standard backbox, and 2) it need to stand off the wall anyway to stay in alignment with the curtain track which also stands off the wall.
So I have decided to mount the motor etc to a drilled blanking plate, which screws to a surface mount backbox. But because the motor is too deep there must be a shallow flush-mount backbox behind the surface mount box to give a few mm extra clearance. Also it needs to be double gang to fit everything in. I hope maybe later I will be able to squeeze everything into a single gang.
Side view: