git » chasquid » commit f69fdc1

dovecot: auto-detect sockets in `/run/dovecot2`

author ThinkChaos
2025-08-13 00:04:00 UTC
committer Alberto Bertogli
2026-09-27 19:40:50 UTC
parent 33049893f034264b74e2d22673d3975e3ef5d771

dovecot: auto-detect sockets in `/run/dovecot2`

NixOS uses this path, and it seems generic enough to be worth adding
here.

The `/var/run` paths should probably also be updated to `/run`, but I'm
not going to risk breaking anything :)

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Adjusted comments.

docs/dovecot.md +2 -2
internal/dovecot/dovecot.go +10 -0

diff --git a/docs/dovecot.md b/docs/dovecot.md
index 853e7cc..660c9de 100644
--- a/docs/dovecot.md
+++ b/docs/dovecot.md
@@ -45,8 +45,8 @@ dovecot_auth: true
 ```
 
 That should be it, because chasquid will "autodetect" the full path to the
-dovecot sockets, by looking in the usual places (tested in Debian, Ubuntu, and
-CentOS).
+dovecot sockets, by looking in the usual places (tested in Debian, Ubuntu,
+CentOS, and NixOS).
 
 If chasquid can't find them, the paths can be set with the
 `dovecot_userdb_path` and `dovecot_client_path` options.
diff --git a/internal/dovecot/dovecot.go b/internal/dovecot/dovecot.go
index 711cd23..38eb18d 100644
--- a/internal/dovecot/dovecot.go
+++ b/internal/dovecot/dovecot.go
@@ -34,11 +34,21 @@ var (
 )
 
 var defaultUserdbPaths = []string{
+	// NixOS.
+	"/run/dovecot2/auth-chasquid-userdb",
+	"/run/dovecot2/auth-userdb",
+
+	// Debian, Ubuntu, CentOS.
 	"/var/run/dovecot/auth-chasquid-userdb",
 	"/var/run/dovecot/auth-userdb",
 }
 
 var defaultClientPaths = []string{
+	// NixOS.
+	"/run/dovecot2/auth-chasquid-client",
+	"/run/dovecot2/auth-client",
+
+	// Debian, Ubuntu, CentOS.
 	"/var/run/dovecot/auth-chasquid-client",
 	"/var/run/dovecot/auth-client",
 }