$os most likely returns some version of Windows as it's emulating Windows.
I'm not sure what a good way of doing that would be, though you could "hack" it by seeing if certain COMs work or other things that aren't emulated completely. Of course, if those are ever emulated all the way, it will stop working. Maybe checking what processes are running (if Wine even allows that) would work and if the Wine program is running, then you know it's using Wine.