@serabouch, unfortunately this is probably harder to do than you might image, especially in vanilla Grasshopper. You would probably constantly have to reevaluate the distribution and make changes as you go which is easier to do in scripting (Python, C#, etc.), if you know how to.
In your case, could the different modules be rotated?
Anyways, check out the following links! Maybe there’s something that helps?
@laurent_delrieu, you seem to be the rectangle packing master! Would you be so kind as to give your five cents?