I've never created nib files from scratch programmatically, but the XML format nibs are easy to modify and use in Xcode templates (we do this in PyObjC).
You may want to look at GNUStep Renaissance <http://www.gnustep.it/Renaissance/>. It's not nib, but it may be more appropriate for your use case.