Unless you are hellbent on using lossless audio (in which case you'll probably run out of capacity after only a comparatively small amount of albums) then go with the Sony S. I've used both the Nano and the Sony S, and the Sony has a number of advantages apart from sound quality:
1. A good, fully customisable EQ, which will probably mean more for sound quality than anything else. This is better than the mystery EQ presets on the Nano.
2. When you are listening to a song, the Walkman interface allows you to easily and quickly jump to more songs from that specific artist, genre, year or album. The Nano only allows to jump around in the same album quickly. It's a little thing, but over time I've really appreciated it.
3. The Sony SenseMe function, which chooses songs based on similar 'moods', is actually quite useful and works a heck of a lot better than the Apple Genius, which only works when you connect to a computer to update it, and only if the songs are avaliable on the iTunes music store.
As for sound quality, I wouldn't be able to say for sure between the Nano and the S. Using an iPhone, I know that they have a fair bit of bass rolloff which the Nanos don't, but I've never been able to do a direct comparison between the S and the Nano.
Just, dont bother using linear PCM/wav on the S - there will be no data tags available!