In a previous thread https://news.ycombinator.com/item?id=24220858 I've suggested the following:
13.8. $COMPANY and any Group Company will not attempt to claim copyright, intellectual property rights, nor patent right to any creation done outside of working hours (also known as employees free time), outside of the premises, and not using any $COMPANY facilities, as long as any such creation does not relate to the employees current responsibilities, and as long as it does not directly compete with $COMPANY business model and business activities.
13.9. As long as you do not go against clause 13.8, you are not obligated to disclose to us your creations.
But this is just my wishful thinking of mine that nobody replied to... and not something that I've actually managed to get written and signed. What I'd like to see is a concrete example of such a clause in a real, existing, signed by both parties, actual contract.But you have to be very specific about what is carved out.
Red Hat being who they are, their approach is extremely relevant to this situation.