Although the Oculus Rift SDK isn’t itself free software, there are already a number of projects that use or replace it that are.
Three.js includes an Oculus Rift demo:
There’s a class for using the Rift with the polular Ogre 3D environment:
EOS3 is a virtual desktop environment:
And so is Ibex:
Vireo Perception is a Direct X ( :-/ ) hooking stereo driver:
And in fact there’s lots of good stuff on Github generally (search for “Oculus Rift”):