I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain to a non-www-prefixed domain:
if ($host ~* www\\.(.*)) { set $h
if ($host !~* ^www\.) { rewrite ^(.*)$ http://www.$host$1 permanent; }