Yes it's fine, also a nipple (raceway 24" or less) can be filed to 60% instead of the typical 40% for more than two conductors. Depending on the conductor size you might not even need a 4" nipple. Another advantage of the short nipple no derating applies either.