Nginx as SMTP and IMAP proxy

I’m trying to configure Nginx TLS reverse proxy for SMTP and IMAP protocol. I tried looking into modules directory inside nixpkgs repository, to find related Nginx package configuration options for NixOS. I tried looking inside official NixOS documentation, but there was only an example of HTTP reverse proxy. Also, I tried appending config snippets to nginx.conf in raw mode, like this:

appendConfig = ''
server {
    listen    25;
    protocol  smtp;
    smtp_auth login plain cram-md5;

server {
    listen   143;
    protocol imap;

but all of that failed. My target is to setup SSL proxy for mail server. Is there any ways to do so in NixOS with Nginx?