;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Andy Wingo ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2017 Carlo Zancanaro ;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2019 Kristofer Buffington ;;; Copyright © 2020 Jonathan Brielmaier ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with
aboutsummaryrefslogtreecommitdiff
blob: 2911a0c550187c91ba19fd65f4d7d076922e9df4 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016, 2017, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages datastructures)
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages build-tools)   ;for meson-0.55
  #:use-module (gnu packages perl)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system meson))

(define-public gdsl
  (package
    (name "gdsl")
    (version "1.8")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://example.org") ;only hosted on Software Heritage
                    (commit "6adb53be8b8f9f2e4bbfc92d357eedeefb4c7430")))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0a52g12d9sf9hhcyvwfd7xdazj2a9i9jh97cnlqf2ymvwnvjk1g0"))))
    (build-system gnu-build-system)
    (home-page "https://web.archive.org/web/20170502005430/http://home.gna.org/gdsl/")
    (synopsis "Generic data structures library")
    (description "The Generic Data Structures Library (GDSL) is a collection
of routines for generic data structures manipulation.  It is a re-entrant
library fully written from scratch in pure ANSI C.  It is designed to offer
for C programmers common data structures with powerful algorithms, and hidden
implementation.  Available structures are lists, queues, stacks, hash tables,
binary trees, binary search trees, red-black trees, 2D arrays, permutations
and heaps.")
    (license license:gpl2+)))

(define-public marisa
  (package
    (name "marisa")
    (version "0.2.6")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://github.com/s-yata/marisa-trie/files/"
                           "4832504/marisa-" version ".tar.gz"))
       (sha256
        (base32 "1pk6wmi28pa8srb4szybrwfn71jldb61c5vgxsiayxcyg1ya4qqh"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("libtool" ,libtool)))
    (home-page "https://github.com/s-yata/marisa-trie")
    (synopsis "Trie data structure C++ library")
    (description "@acronym{MARISA, Matching Algorithm with Recursively
Implemented StorAge} is a static and space-efficient trie data structure C++
library.")

    ;; Dual-licensed, according to docs/readme.en.html (source files lack
    ;; copyright/license headers.)
    (license (list license:bsd-2 license:lgpl2.1+))))

(define-public sparsehash
  (package
    (name "sparsehash")
    (version "2.0.4")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                     (url "https://github.com/sparsehash/sparsehash")
                     (commit (string-append name "-" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1pf1cjvcjdmb9cd6gcazz64x0cd2ndpwh6ql2hqpypjv725xwxy7"))))
    (build-system gnu-build-system)
    (synopsis "Memory-efficient hashtable implementations")
    (description
     "This library contains several hash-map implementations, similar in API
to SGI's @code{hash_map} class, but with different performance
characteristics.  @code{sparse_hash_map} uses very little space overhead, 1-2
bits per entry.  @code{dense_hash_map} is very fast, particularly on lookup.
@code{sparse_hash_set} and @code{dense_hash_set} are the set versions of these
routines.  All these implementation use a hashtable with internal quadratic
probing.  This method is space-efficient -- there is no pointer overhead --
and time-efficient for good hash functions.")
    (home-page "https://github.com/sparsehash/sparsehash")
    (license license:bsd-3)))

(define-public ssdeep
  (package
    (name "ssdeep")
    (version "2.14.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://github.com/ssdeep-project/ssdeep/"
                           "releases/download/release-" version "/"
                           "ssdeep-" version ".tar.gz"))
       (sha256
        (base32 "04qkjc6kksxkv7xbnk32rwmf3a8czdv2vvrdzfs0kw06h73snbpz"))))
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags
       (list "--disable-static")))
    (home-page "https://ssdeep-project.github.io")
    (synopsis "Context-triggered piecewise hashing algorithm")
    (description "ssdeep computes and matches context triggered piecewise
hashes (CTPH), also called fuzzy checksums.  It can identify similar files
that have sequences of identical bytes in the same order, even though bytes
in between these sequences may be different in both content and length.")
    (license license:gpl2+)))

(define-public liburcu
  (package
    (name "liburcu")
    (version "0.12.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://www.lttng.org/files/urcu/"
                                  "userspace-rcu-" version ".tar.bz2"))
              (sha256
               (base32
                "03nd1gy2c3fdb6xwdrd5lr1jcjxbzffqh3z91mzbjhjn6k8fmymv"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("perl" ,perl)))                 ; for tests
    (home-page "https://liburcu.org/")
    (synopsis "User-space RCU data synchronisation library")
    (description "liburcu is a user-space @dfn{Read-Copy-Update} (RCU) data
synchronisation library.  It provides read-side access that scales linearly
with the number of cores.  liburcu-cds provides efficient data structures
based on RCU and lock-free algorithms.  These structures include hash tables,
queues, stacks, and doubly-linked lists.")
    (license license:lgpl2.1+)))

(define-public uthash
  (package
    (name "uthash")
    (version "2.1.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/troydhanson/uthash")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0k80bjbb6ss5wpmfmfji6xbyjm990hg9kcshwwnhdnh73vxkcd1m"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("perl" ,perl)))
    (arguments
     `(#:make-flags
       (list "CC=gcc")
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)            ; nothing to configure
         (delete 'build)                ; nothing to build
         (replace 'check
           (lambda* (#:key make-flags #:allow-other-keys)
             (with-directory-excursion "tests"
               (apply invoke "make" make-flags))))
         (replace 'install
           ;; There is no top-level Makefile to do this for us.
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (doc (string-append out "/share/doc/" ,name "-" ,version))
                    (include (string-append out "/include")))
               ;; Don't install HTML files: they're just the below .txt files
               ;; dolled up, can be stale, and regeneration requires asciidoc.
               (for-each (λ (file) (install-file file doc))
                         (find-files "doc" "\\.txt$"))
               (for-each (λ (file) (install-file file include))
                         (find-files "src" "\\.h$"))
               #t))))))
    (home-page "https://troydhanson.github.io/uthash/")
    (synopsis
     "Hash tables, lists, and other data structures implemented as C macros")
    (description
     "uthash implements a hash table and a few other basic data structures
as C preprocessor macros.  It aims to be minimalistic and efficient: it's
around 1,000 lines of code which, being macros, inline automatically.

Unlike function calls with fixed prototypes, macros operate on untyped
arguments.  Thus, they are able to work with any type of structure and key.
Any C structure can be stored in a hash table by adding @code{UT_hash_handle}
to the structure and choosing one or more fields to act as the key.")
    (license license:bsd-2)))

(define-public sdsl-lite
  (package
    (name "sdsl-lite")
    (version "2.1.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/simongog/sdsl-lite/"
                                  "releases/download/v" version "/"
                                  "sdsl-lite-" version
                                  ".tar.gz.offline.install.gz"))
              (sha256
               (base32
                "1v86ivv3mmdy802i9xkjpxb4cggj3s27wb19ja4sw1klnivjj69g"))
              (modules '((guix build utils)))
              (snippet
               '(begin
                  (delete-file-recursively "external") #t))
              (patches
                (list (origin
                        (method url-fetch)
                        (uri "https://salsa.debian.org/science-team/libsdsl/raw/debian/2.1.1+dfsg-2/debian/patches/0001-Patch-cmake-files.patch")
                        (file-name "sdsl-lite-dont-use-bundled-libraries.patch")
                        (sha256
                         (base32
                          "0m542xpys54bni29zibgrfpgpd0zgyny4h131virxsanixsbz52z")))))))
    (build-system cmake-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'install 'install-static-library
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (copy-file "lib/libsdsl_static.a"
                          (string-append out "/lib/libsdsl.a")))
             #t))
        (add-after 'install 'install-pkgconfig-file
          (lambda* (#:key outputs #:allow-other-keys)
            (let* ((out (assoc-ref outputs "out"))
                   (lib (string-append out "/lib")))
              (mkdir-p (string-append lib "/pkgconfig"))
              (with-output-to-file (string-append lib "/pkgconfig/sdsl-lite.pc")
                (lambda _
                  (format #t "prefix=~a~@
                          exec_prefix=${prefix}~@
                          libdir=${exec_prefix}/lib~@
                          includedir=${prefix}/include~@
                          ~@
                          ~@
                          Name: sdsl~@
                          Version: ~a~@
                          Description: SDSL: Succinct Data Structure Library~@
                          Libs: -L${libdir} -lsdsl -ldivsufsort -ldivsufsort64~@
                          Cflags: -I${includedir}~%"
                          out ,version)))
              #t))))))
    (native-inputs
     `(("libdivsufsort" ,libdivsufsort)))
    (home-page "https://github.com/simongog/sdsl-lite")
    (synopsis "Succinct data structure library")
    (description "The Succinct Data Structure Library (SDSL) is a powerful and
flexible C++11 library implementing succinct data structures.  In total, the
library contains the highlights of 40 research publications.  Succinct data
structures can represent an object (such as a bitvector or a tree) in space
close to the information-theoretic lower bound of the object while supporting
operations of the original object efficiently.  The theoretical time
complexity of an operation performed on the classical data structure and the
equivalent succinct data structure are (most of the time) identical.")
    (license license:gpl3+)))

(define-public tllist
  (package
    (name "tllist")
    (version "1.0.4")
    (home-page "https://codeberg.org/dnkl/tllist")
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page) (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1a26vwb7ll6mv3h8rbafsdx4vic1f286hiqn8s359sw8b7yjkvzs"))))
    (build-system meson-build-system)
    (arguments
     `(#:meson ,meson-0.55))
    (synopsis "Typed link list for C")
    (description
     "@code{tllist} is a @dfn{typed linked list} C header file only library
implemented using pre-processor macros.  It supports primitive data types as
well as aggregated ones such as structs, enums and unions.")
    (license license:expat)))

(define-public libdivsufsort
  (package
    (name "libdivsufsort")
    (version "2.0.1")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/y-256/libdivsufsort")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0fgdz9fzihlvjjrxy01md1bv9vh12rkgkwbm90b1hj5xpbaqp7z2"))))
    (build-system cmake-build-system)
    (arguments
     '(#:tests? #f                      ; there are no tests
       #:configure-flags
       ;; Needed for rapmap and sailfish.
       '("-DBUILD_DIVSUFSORT64=ON")))
    (home-page "https://github.com/y-256/libdivsufsort")
    (synopsis "Lightweight suffix-sorting library")
    (description "libdivsufsort is a software library that implements a
lightweight suffix array construction algorithm.  This library provides a
simple and an efficient C API to construct a suffix array and a
Burrows-Wheeler transformed string from a given string over a constant-size
alphabet.  The algorithm runs in O(n log n) worst-case time using only 5n+O(1)
bytes of memory space, where n is the length of the string.")
    (license license:expat)))

(define-public robin-map
  (package
    (name "robin-map")
    (version "0.6.3")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/Tessil/robin-map")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1li70vwsksva9c4yly90hjafgqfixi1g6d52qq9p6r60vqc4pkjj"))))
    (build-system cmake-build-system)
    (native-inputs
     `(("boost" ,boost)))  ; needed for tests
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (mkdir "tests")
             (with-directory-excursion "tests"
               (invoke "cmake" "../../source/tests")
               (invoke "cmake" "--build" ".")
               (invoke "./tsl_robin_map_tests")))))))
    (home-page "https://github.com/Tessil/robin-map")
    (synopsis "C++ implementation of a fast hash map and hash set")
    (description "The robin-map library is a C++ implementation of a fast hash
map and hash set using open-addressing and linear robin hood hashing with
backward shift deletion to resolve collisions.

Four classes are provided: tsl::robin_map, tsl::robin_set, tsl::robin_pg_map
and tsl::robin_pg_set. The first two are faster and use a power of two growth
policy, the last two use a prime growth policy instead and are able to cope
better with a poor hash function.")
    (license license:expat)))
ds. You can use either numbers or names. .") (mail-gid (string "") "") (mail-privileged-group (string "") "Group to enable temporarily for privileged operations. Currently this is used only with INBOX when either its initial creation or dotlocking fails. Typically this is set to \"mail\" to give access to /var/mail.") (mail-access-groups (string "") "Grant access to these supplementary groups for mail processes. Typically these are used to set up access to shared mailboxes. Note that it may be dangerous to set these if users can create symlinks (e.g. if \"mail\" group is set here, ln -s /var/mail ~/mail/var could allow a user to delete others' mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading it).") (mail-full-filesystem-access? (boolean #f) "Allow full file system access to clients. There's no access checks other than what the operating system does for the active UID/GID. It works with both maildir and mboxes, allowing you to prefix mailboxes names with e.g. /path/ or ~user/.") ;;; Mail processes (mmap-disable? (boolean #f) "Don't use mmap() at all. This is required if you store indexes to shared file systems (NFS or clustered file system).") (dotlock-use-excl? (boolean #t) "Rely on @samp{O_EXCL} to work when creating dotlock files. NFS supports @samp{O_EXCL} since version 3, so this should be safe to use nowadays by default.") (mail-fsync (string "optimized") "When to use fsync() or fdatasync() calls: @table @code @item optimized Whenever necessary to avoid losing important data @item always Useful with e.g. NFS when write()s are delayed @item never Never use it (best performance, but crashes can lose data). @end table") (mail-nfs-storage? (boolean #f) "Mail storage exists in NFS. Set this to yes to make Dovecot flush NFS caches whenever needed. If you're using only a single mail server this isn't needed.") (mail-nfs-index? (boolean #f) "Mail index files also exist in NFS. Setting this to yes requires @samp{mmap-disable? #t} and @samp{fsync-disable? #f}.") (lock-method (string "fcntl") "Locking method for index files. Alternatives are fcntl, flock and dotlock. Dotlocking uses some tricks which may create more disk I/O than other locking methods. NFS users: flock doesn't work, remember to change @samp{mmap-disable}.") (mail-temp-dir (file-name "/tmp") "Directory in which LDA/LMTP temporarily stores incoming mails >128 kB.") (first-valid-uid (non-negative-integer 500) "Valid UID range for users. This is mostly to make sure that users can't log in as daemons or other system users. Note that denying root logins is hardcoded to dovecot binary and can't be done even if @samp{first-valid-uid} is set to 0.") (last-valid-uid (non-negative-integer 0) "") (first-valid-gid (non-negative-integer 1) "Valid GID range for users. Users having non-valid GID as primary group ID aren't allowed to log in. If user belongs to supplementary groups with non-valid GIDs, those groups are not set.") (last-valid-gid (non-negative-integer 0) "") (mail-max-keyword-length (non-negative-integer 50) "Maximum allowed length for mail keyword name. It's only forced when trying to create new keywords.") (valid-chroot-dirs (colon-separated-file-name-list '()) "List of directories under which chrooting is allowed for mail processes (i.e. /var/mail will allow chrooting to /var/mail/foo/bar too). This setting doesn't affect @samp{login-chroot} @samp{mail-chroot} or auth chroot settings. If this setting is empty, \"/./\" in home dirs are ignored. WARNING: Never add directories here which local users can modify, that may lead to root exploit. Usually this should be done only if you don't allow shell access for users. .") (mail-chroot (string "") "Default chroot directory for mail processes. This can be overridden for specific users in user database by giving /./ in user's home directory (e.g. /home/./user chroots into /home). Note that usually there is no real need to do chrooting, Dovecot doesn't allow users to access files outside their mail directory anyway. If your home directories are prefixed with the chroot directory, append \"/.\" to @samp{mail-chroot}. .") (auth-socket-path (file-name "/var/run/dovecot/auth-userdb") "UNIX socket path to master authentication server to find users. This is used by imap (for shared users) and lda.") (mail-plugin-dir (file-name "/usr/lib/dovecot") "Directory where to look up mail plugins.") (mail-plugins (space-separated-string-list '()) "List of plugins to load for all services. Plugins specific to IMAP, LDA, etc. are added to this list in their own .conf files.") (mail-cache-min-mail-count (non-negative-integer 0) "The minimum number of mails in a mailbox before updates are done to cache file. This allows optimizing Dovecot's behavior to do less disk writes at the cost of more disk reads.") (mailbox-idle-check-interval (string "30 secs") "When IDLE command is running, mailbox is checked once in a while to see if there are any new mails or other changes. This setting defines the minimum time to wait between those checks. Dovecot can also use dnotify, inotify and kqueue to find out immediately when changes occur.") (mail-save-crlf? (boolean #f) "Save mails with CR+LF instead of plain LF. This makes sending those mails take less CPU, especially with sendfile() syscall with Linux and FreeBSD. But it also creates a bit more disk I/O which may just make it slower. Also note that if other software reads the mboxes/maildirs, they may handle the extra CRs wrong and cause problems.") (maildir-stat-dirs? (boolean #f) "By default LIST command returns all entries in maildir beginning with a dot. Enabling this option makes Dovecot return only entries which are directories. This is done by stat()ing each entry, so it causes more disk I/O. (For systems setting struct @samp{dirent->d_type} this check is free and it's done always regardless of this setting).") (maildir-copy-with-hardlinks? (boolean #t) "When copying a message, do it with hard links whenever possible. This makes the performance much better, and it's unlikely to have any side effects.") (maildir-very-dirty-syncs? (boolean #f) "Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only when its mtime changes unexpectedly or when we can't find the mail otherwise.") (mbox-read-locks (space-separated-string-list '("fcntl")) "Which locking methods to use for locking mbox. There are four available: @table @code @item dotlock Create .lock file. This is the oldest and most NFS-safe solution. If you want to use /var/mail/ like directory, the users will need write access to that directory. @item dotlock-try Same as dotlock, but if it fails because of permissions or because there isn't enough disk space, just skip it. @item fcntl Use this if possible. Works with NFS too if lockd is used. @item flock May not exist in all systems. Doesn't work with NFS. @item lockf May not exist in all systems. Doesn't work with NFS. @end table You can use multiple locking methods; if you do the order they're declared in is important to avoid deadlocks if other MTAs/MUAs are using multiple locking methods as well. Some operating systems don't allow using some of them simultaneously.") (mbox-write-locks (space-separated-string-list '("dotlock" "fcntl")) "") (mbox-lock-timeout (string "5 mins") "Maximum time to wait for lock (all of them) before aborting.") (mbox-dotlock-change-timeout (string "2 mins") "If dotlock exists but the mailbox isn't modified in any way, override the lock file after this much time.") (mbox-dirty-syncs? (boolean #t) "When mbox changes unexpectedly we have to fully read it to find out what changed. If the mbox is large this can take a long time. Since the change is usually just a newly appended mail, it'd be faster to simply read the new mails. If this setting is enabled, Dovecot does this but still safely fallbacks to re-reading the whole mbox file whenever something in mbox isn't how it's expected to be. The only real downside to this setting is that if some other MUA changes message flags, Dovecot doesn't notice it immediately. Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK commands.") (mbox-very-dirty-syncs? (boolean #f) "Like @samp{mbox-dirty-syncs}, but don't do full syncs even with SELECT, EXAMINE, EXPUNGE or CHECK commands. If this is set, @samp{mbox-dirty-syncs} is ignored.") (mbox-lazy-writes? (boolean #t) "Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK commands and when closing the mailbox). This is especially useful for POP3 where clients often delete all mails. The downside is that our changes aren't immediately visible to other MUAs.") (mbox-min-index-size (non-negative-integer 0) "If mbox size is smaller than this (e.g. 100k), don't write index files. If an index file already exists it's still read, just not updated.") (mdbox-rotate-size (non-negative-integer #e10e6) "Maximum dbox file size until it's rotated.") (mdbox-rotate-interval (string "1d") "Maximum dbox file age until it's rotated. Typically in days. Day begins from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled.") (mdbox-preallocate-space? (boolean #f) "When creating new mdbox files, immediately preallocate their size to @samp{mdbox-rotate-size}. This setting currently works only in Linux with some file systems (ext4, xfs).") (mail-attribute-dict (string "") "The location of a dictionary used to store @code{IMAP METADATA} as defined by @uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}. The IMAP METADATA commands are available only if the ``imap'' protocol configuration's @code{imap-metadata?} field is @samp{#t}.") (mail-attachment-dir (string "") "sdbox and mdbox support saving mail attachments to external files, which also allows single instance storage for them. Other backends don't support this for now. WARNING: This feature hasn't been tested much yet. Use at your own risk. Directory root where to store mail attachments. Disabled, if empty.") (mail-attachment-min-size (non-negative-integer #e128e3) "Attachments smaller than this aren't saved externally. It's also possible to write a plugin to disable saving specific attachments externally.") (mail-attachment-fs (string "sis posix") "File system backend to use for saving attachments: @table @code @item posix No SiS done by Dovecot (but this might help FS's own deduplication) @item sis posix SiS with immediate byte-by-byte comparison during saving @item sis-queue posix SiS with delayed comparison and deduplication. @end table") (mail-attachment-hash (string "%{sha1}") "Hash format to use in attachment filenames. You can add any text and variables: @code{%@{md4@}}, @code{%@{md5@}}, @code{%@{sha1@}}, @code{%@{sha256@}}, @code{%@{sha512@}}, @code{%@{size@}}. Variables can be truncated, e.g. @code{%@{sha256:80@}} returns only first 80 bits.") (default-process-limit (non-negative-integer 100) "") (default-client-limit (non-negative-integer 1000) "") (default-vsz-limit (non-negative-integer #e256e6) "Default VSZ (virtual memory size) limit for service processes. This is mainly intended to catch and kill processes that leak memory before they eat up everything.") (default-login-user (string "dovenull") "Login user is internally used by login processes. This is the most untrusted user in Dovecot system. It shouldn't have access to anything at all.") (default-internal-user (string "dovecot") "Internal user is used by unprivileged processes. It should be separate from login user, so that login processes can't disturb other processes.") (ssl? (string "required") "SSL/TLS support: yes, no, required. .") (ssl-cert (string ". %d expands to recipient domain.") (hostname (string "") "Hostname to use in various parts of sent mails (e.g. in Message-Id) and in LMTP replies. Default is the system's real hostname@@domain.") (quota-full-tempfail? (boolean #f) "If user is over quota, return with temporary failure instead of bouncing the mail.") (sendmail-path (file-name "/usr/sbin/sendmail") "Binary to use for sending mails.") (submission-host (string "") "If non-empty, send mails via this SMTP host[:port] instead of sendmail.") (rejection-subject (string "Rejected: %s") "Subject: header to use for rejection mails. You can use the same variables as for @samp{rejection-reason} below.") (rejection-reason (string "Your message to <%t> was automatically rejected:%n%r") "Human readable error message for rejection mails. You can use variables: @table @code @item %n CRLF @item %r reason @item %s original subject @item %t recipient @end table") (recipient-delimiter (string "+") "Delimiter character between local-part and detail in email address.") (lda-original-recipient-header (string "") "Header where the original recipient address (SMTP's RCPT TO: address) is taken from if not available elsewhere. With dovecot-lda -a parameter overrides this. A commonly used header for this is X-Original-To.") (lda-mailbox-autocreate? (boolean #f) "Should saving a mail to a nonexistent mailbox automatically create it?.") (lda-mailbox-autosubscribe? (boolean #f) "Should automatically created mailboxes be also automatically subscribed?.") (imap-max-line-length (non-negative-integer #e64e3) "Maximum IMAP command line length. Some clients generate very long command lines with huge mailboxes, so you may need to raise this if you get \"Too long argument\" or \"IMAP command line too large\" errors often.") (imap-logout-format (string "in=%i out=%o deleted=%{deleted} expunged=%{expunged} trashed=%{trashed} hdr_count=%{fetch_hdr_count} hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} body_bytes=%{fetch_body_bytes}") "IMAP logout format string: @table @code @item %i total number of bytes read from client @item %o total number of bytes sent to client. @end table See @file{doc/wiki/Variables.txt} for a list of all the variables you can use.") (imap-capability (string "") "Override the IMAP CAPABILITY response. If the value begins with '+', add the given capabilities on top of the defaults (e.g. +XFOO XBAR).") (imap-idle-notify-interval (string "2 mins") "How long to wait between \"OK Still here\" notifications when client is IDLEing.") (imap-id-send (string "") "ID field names and values to send to clients. Using * as the value makes Dovecot use the default value. The following fields have default values currently: name, version, os, os-version, support-url, support-email.") (imap-id-log (string "") "ID fields sent by client to log. * means everything.") (imap-client-workarounds (space-separated-string-list '()) "Workarounds for various client bugs: @table @code @item delay-newmail Send EXISTS/RECENT new mail notifications only when replying to NOOP and CHECK commands. Some clients ignore them otherwise, for example OSX Mail ( for CONFIG." (let ((dovecot (if (opaque-dovecot-configuration? config) (opaque-dovecot-configuration-dovecot config) (dovecot-configuration-dovecot config)))) (list (shepherd-service (documentation "Run the Dovecot POP3/IMAP mail server.") (provision '(dovecot)) (requirement '(pam networking)) (start #~(make-forkexec-constructor (list (string-append #$dovecot "/sbin/dovecot") "-F"))) (stop #~(lambda _ (invoke #$(file-append dovecot "/sbin/dovecot") "stop") #f)))))) (define %dovecot-pam-services (list (unix-pam-service "dovecot"))) (define dovecot-service-type (service-type (name 'dovecot) (extensions (list (service-extension shepherd-root-service-type dovecot-shepherd-service) (service-extension account-service-type (const %dovecot-accounts)) (service-extension pam-root-service-type (const %dovecot-pam-services)) (service-extension activation-service-type %dovecot-activation))) (description "Run Dovecot, a mail server that can run POP3, IMAP, and LMTP.") (default-value (dovecot-configuration)))) (define-deprecated (dovecot-service #:key (config (dovecot-configuration))) dovecot-service-type "Return a service that runs @command{dovecot}, a mail server that can run POP3, IMAP, and LMTP. @var{config} should be a configuration object created by @code{dovecot-configuration}. @var{config} may also be created by @code{opaque-dovecot-configuration}, which allows specification of the @code{dovecot.conf} as a string." (service dovecot-service-type config)) ;; A little helper to make it easier to document all those fields. (define (generate-dovecot-documentation) (generate-documentation `((dovecot-configuration ,dovecot-configuration-fields (dict dict-configuration) (namespaces namespace-configuration) (plugin plugin-configuration) (passdbs passdb-configuration) (userdbs userdb-configuration) (services service-configuration) (protocols protocol-configuration)) (dict-configuration ,dict-configuration-fields) (plugin-configuration ,plugin-configuration-fields) (passdb-configuration ,passdb-configuration-fields) (userdb-configuration ,userdb-configuration-fields) (unix-listener-configuration ,unix-listener-configuration-fields) (fifo-listener-configuration ,fifo-listener-configuration-fields) (inet-listener-configuration ,inet-listener-configuration-fields) (namespace-configuration ,namespace-configuration-fields (mailboxes mailbox-configuration)) (mailbox-configuration ,mailbox-configuration-fields) (service-configuration ,service-configuration-fields (listeners unix-listener-configuration fifo-listener-configuration inet-listener-configuration)) (protocol-configuration ,protocol-configuration-fields)) 'dovecot-configuration)) ;;; ;;; OpenSMTPD. ;;; (define-record-type* opensmtpd-configuration make-opensmtpd-configuration opensmtpd-configuration? (package opensmtpd-configuration-package (default opensmtpd)) (shepherd-requirement opensmtpd-configuration-shepherd-requirement (default '())) ; list of symbols (config-file opensmtpd-configuration-config-file (default %default-opensmtpd-config-file)) (setgid-commands? opensmtpd-setgid-commands? (default #t))) (define %default-opensmtpd-config-file (plain-file "smtpd.conf" " listen on lo action inbound mbox match for local action inbound action outbound relay match from local for any action outbound ")) (define (opensmtpd-shepherd-service config) (match-record config (package config-file shepherd-requirement) (list (shepherd-service (provision '(smtpd)) (requirement `(pam loopback ,@shepherd-requirement)) (documentation "Run the OpenSMTPD daemon.") (start (let ((smtpd (file-append package "/sbin/smtpd"))) #~(make-forkexec-constructor (list #$smtpd "-f" #$config-file) #:pid-file "/var/run/smtpd.pid"))) (stop #~(make-kill-destructor)))))) (define %opensmtpd-accounts (list (user-group (name "smtpq") (system? #t)) (user-account (name "smtpd") (group "nogroup") (system? #t) (comment "SMTP Daemon") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))) (user-account (name "smtpq") (group "smtpq") (system? #t) (comment "SMTPD Queue") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) (define (opensmtpd-activation config) (match-record config (package config-file) (let ((smtpd (file-append package "/sbin/smtpd"))) #~(begin (use-modules (guix build utils)) ;; Create mbox and spool directories. (mkdir-p "/var/mail") (mkdir-p "/var/spool/smtpd") (chmod "/var/spool/smtpd" #o711) (mkdir-p "/var/spool/mail") (chmod "/var/spool/mail" #o711))))) (define %opensmtpd-pam-services (list (unix-pam-service "smtpd"))) (define (opensmtpd-set-gids config) (match-record config (package config-file setgid-commands?) (if setgid-commands? (list (setuid-program (program (file-append package "/sbin/smtpctl")) (setuid? #false) (setgid? #true) (group "smtpq")) (setuid-program (program (file-append package "/sbin/sendmail")) (setuid? #false) (setgid? #true) (group "smtpq")) (setuid-program (program (file-append package "/sbin/send-mail")) (setuid? #false) (setgid? #true) (group "smtpq")) (setuid-program (program (file-append package "/sbin/makemap")) (setuid? #false) (setgid? #true) (group "smtpq")) (setuid-program (program (file-append package "/sbin/mailq")) (setuid? #false) (setgid? #true) (group "smtpq")) (setuid-program (program (file-append package "/sbin/newaliases")) (setuid? #false) (setgid? #true) (group "smtpq"))) '()))) (define opensmtpd-service-type (service-type (name 'opensmtpd) (extensions (list (service-extension account-service-type (const %opensmtpd-accounts)) (service-extension activation-service-type opensmtpd-activation) (service-extension pam-root-service-type (const %opensmtpd-pam-services)) (service-extension profile-service-type (compose list opensmtpd-configuration-package)) (service-extension shepherd-root-service-type opensmtpd-shepherd-service) (service-extension setuid-program-service-type opensmtpd-set-gids))) (description "Run the OpenSMTPD, a lightweight @acronym{SMTP, Simple Mail Transfer Protocol} server."))) ;;; ;;; mail aliases. ;;; (define (mail-aliases-etc aliases) `(("aliases" ,(plain-file "aliases" ;; Ideally we'd use a format string like ;; "~:{~a: ~{~a~^,~}\n~}", but it gives a ;; warning that I can't figure out how to fix, ;; so we'll just use string-join below instead. (format #f "~:{~a: ~a\n~}" (map (match-lambda ((alias addresses ...) (list alias (string-join addresses ",")))) aliases)))))) (define mail-aliases-service-type (service-type (name 'mail-aliases) (extensions (list (service-extension etc-service-type mail-aliases-etc))) (compose concatenate) (extend append) (description "Provide a @file{/etc/aliases} file---an email alias database---computed from the given alias list."))) ;;; ;;; Exim. ;;; (define-record-type* exim-configuration make-exim-configuration exim-configuration? (package exim-configuration-package ;file-like (default exim)) (config-file exim-configuration-config-file ;file-like (default #f))) (define %exim-accounts (list (user-group (name "exim") (system? #t)) (user-account (name "exim") (group "exim") (system? #t) (comment "Exim Daemon") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) (define (exim-computed-config-file package config-file) (computed-file "exim.conf" #~(call-with-output-file #$output (lambda (port) (format port " exim_user = exim exim_group = exim .include ~a" #$(or config-file (file-append package "/etc/exim.conf"))))))) (define exim-shepherd-service (match-lambda (($ package config-file) (list (shepherd-service (provision '(exim mta)) (documentation "Run the exim daemon.") (requirement '(networking)) (start #~(make-forkexec-constructor '(#$(file-append package "/bin/exim") "-bd" "-v" "-C" #$(exim-computed-config-file package config-file)))) (stop #~(make-kill-destructor))))))) (define exim-activation (match-lambda (($ package config-file) (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) (let ((uid (passwd:uid (getpw "exim"))) (gid (group:gid (getgr "exim")))) (mkdir-p "/var/spool/exim") (chown "/var/spool/exim" uid gid)) (zero? (system* #$(file-append package "/bin/exim") "-bV" "-C" #$(exim-computed-config-file package config-file)))))))) (define exim-profile (compose list exim-configuration-package)) (define exim-service-type (service-type (name 'exim) (extensions (list (service-extension shepherd-root-service-type exim-shepherd-service) (service-extension account-service-type (const %exim-accounts)) (service-extension activation-service-type exim-activation) (service-extension profile-service-type exim-profile) (service-extension mail-aliases-service-type (const '())))) (description "Run the Exim mail transfer agent (MTA)."))) ;;; ;;; GNU Mailutils IMAP4 Daemon. ;;; (define %default-imap4d-config-file (plain-file "imap4d.conf" "server localhost {};\n")) (define-record-type* imap4d-configuration make-imap4d-configuration imap4d-configuration? (package imap4d-configuration-package (default mailutils)) (config-file imap4d-configuration-config-file (default %default-imap4d-config-file))) (define imap4d-shepherd-service (match-lambda (($ package config-file) (list (shepherd-service (provision '(imap4d)) (requirement '(networking syslogd)) (documentation "Run the imap4d daemon.") (start (let ((imap4d (file-append package "/sbin/imap4d"))) #~(make-forkexec-constructor (list #$imap4d "--daemon" "--foreground" "--config-file" #$config-file)))) (stop #~(make-kill-destructor))))))) (define imap4d-service-type (service-type (name 'imap4d) (description "Run the GNU @command{imap4d} to serve e-mail messages through IMAP.") (extensions (list (service-extension shepherd-root-service-type imap4d-shepherd-service))) (default-value (imap4d-configuration)))) ;;; ;;; Radicale. ;;; (define-record-type* radicale-configuration make-radicale-configuration radicale-configuration? (package radicale-configuration-package (default radicale)) (config-file radicale-configuration-config-file (default %default-radicale-config-file))) (define %default-radicale-config-file (plain-file "radicale.conf" " [auth] type = htpasswd htpasswd_filename = /var/lib/radicale/users htpasswd_encryption = plain [server] hosts = localhost:5232")) (define %radicale-accounts (list (user-group (name "radicale") (system? #t)) (user-account (name "radicale") (group "radicale") (system? #t) (comment "Radicale Daemon") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) (define radicale-shepherd-service (match-lambda (($ package config-file) (list (shepherd-service (provision '(radicale)) (documentation "Run the radicale daemon.") (requirement '(networking)) (start #~(make-forkexec-constructor (list #$(file-append package "/bin/radicale") "-C" #$config-file) #:user "radicale" #:group "radicale")) (stop #~(make-kill-destructor))))))) (define radicale-activation (match-lambda (($ package config-file) (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) (let ((uid (passwd:uid (getpw "radicale"))) (gid (group:gid (getgr "radicale")))) (mkdir-p "/var/lib/radicale/collections") (chown "/var/lib/radicale" uid gid) (chown "/var/lib/radicale/collections" uid gid) (chmod "/var/lib/radicale" #o700))))))) (define radicale-service-type (service-type (name 'radicale) (description "Run radicale, a small CalDAV and CardDAV server.") (extensions (list (service-extension shepherd-root-service-type radicale-shepherd-service) (service-extension account-service-type (const %radicale-accounts)) (service-extension activation-service-type radicale-activation))) (default-value (radicale-configuration))))