Dovecot installation problems


Hi All,

I want to use dovecot as a local IMAP server to serve my offlineimap synced mails to gnus. I have installed the dovecot package via my configuration.nix. however I am having trouble configuring it, seeing where the log files are, etc. I copy the configuration files (dovecot.conf and config.d) from /nix/store/dovecot/share/doc/dovecot/example-config. I can then modify slightly the files to allow plain login (no ssl required) just to test.I can start dovecot (as root). I see the process running, the relevant ports are open and listening, e.g. 143. Everything looks OK. No crashes. However when I telnet localhost 143 (for imap) to test, I am connected and then immediately the connection is closed by foreign host. This is not what I expect from the Dovecot Wiki. I should get a statement that Dovecot is ready …

Additionally, the command doveadm log find responds with:

Looking for log files from /var/log
Debug: Not found
Info: Not found

So there seem to be no log files. journalctl -u dovecot2.service shows logs begin …, end at …

No entries, so no issues ? I cannot find a log file which tells me why the connection on 143 is immediately closed.

I am at a loss what is going on. Is it to do with users needed, etc ? Appreciate any help. Can post doveconf -n if needed.


How about configuring services.dovecot in configuration.nix instead of trying to run it manually? It’s supposed to be the correct way to run a service.

(I don’t have any experience with this software, inside or outside of Nixos. So I don’t know of any specifics.)


Yes, I was starting to understand that would be the better way to start dovecot. I am new to nixos so I see that that is the standard way to run a service.

However, I think that the problem is more to do with configuring the software rather than how I start it. It may be though that I am not getting error logging in, e.g. /var/log/mail.log because it is not started with systemd ?


I use dovecot to serve mbsync-downloaded email (offlineimap alternative) and used to read it with gnus.

You can find my configs here:

(Gnus uses “shell” stream, so it does not open TCP connection, though.)


NixOS tends to configure server software in a way that differs considerably from upstream defaults. So possibly your system just doesn’t have the necessary environment (users, directories, filesystem access rights, etc.) to properly run your configuration; the dovecot2 module (activated via services.dovecot2) would provide the necessary environment and the necessary configuration.


That is very useful rasendubi, thanks. And that relates to pvgoran’s second comment. I also think that the problem is that I don’t have the necessary environment set up (users, directories, etc). I will setup using the dovecot2 module as in rasendubi’s link and see from there if I have more problems.


Here is a real-world configuration for dovecot: dovecot

I run it together with postfix and rspamd


There is also a nixos-based project that aims at simplifying the configuration a mail server by providing a baseline configuration:


Thanks everyone. I have a setup working now. It needs some refinement but basically works. The key was, of course, setting up the dovecot2 module as a service in my configuration.nix. Then the environment was established for me. Clearly I need to understand better the nixos approach (I have been using arch and ubuntu up to now).

If I have more questions, later I will add them.


This worked for me but only my Inbox is accessible through Gnus. I think Dovecot is having a difficult time traversing my maildir?

Here’s my mbsyncrc:

Relevant dovecot2 declaration of my configuration.nix:

My gnus declaration is the same, substituted with my own personal details.

I’ve sunk a good 2 days into this. I’m about to admit defeat.


This worked for me but only my Inbox is accessible through Gnus. I think Dovecot is having a difficult time traversing my maildir?

Do you see other directories under ~/Maildir/fastmail?

Do you see them in gnus server mode? (^)

Did you subscribe to them?


Ah, I mistook L for ^, thank you! I am now a happy Gnus user