Skip to content
Snippets Groups Projects
guix.texi 444 KiB
Newer Older
  • Learn to ignore specific revisions
  • Andy Wingo's avatar
    Andy Wingo committed
    is set to 0.
    Defaults to @samp{500}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer last-valid-uid
    
    Defaults to @samp{0}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer first-valid-gid
    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.
    Defaults to @samp{1}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer last-valid-gid
    
    Defaults to @samp{0}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mail-max-keyword-length
    Maximum allowed length for mail keyword name.  It's only forced when
    trying to create new keywords.
    Defaults to @samp{50}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} colon-separated-file-name-list valid-chroot-dirs
    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.
    <doc/wiki/Chrooting.txt>.
    Defaults to @samp{()}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mail-chroot
    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}.  <doc/wiki/Chrooting.txt>.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} file-name auth-socket-path
    UNIX socket path to master authentication server to find users.
    This is used by imap (for shared users) and lda.
    Defaults to @samp{"/var/run/dovecot/auth-userdb"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} file-name mail-plugin-dir
    Directory where to look up mail plugins.
    Defaults to @samp{"/usr/lib/dovecot"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mail-plugins
    List of plugins to load for all services.  Plugins specific to IMAP,
    LDA, etc. are added to this list in their own .conf files.
    Defaults to @samp{()}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mail-cache-min-mail-count
    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.
    Defaults to @samp{0}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mailbox-idle-check-interval
    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.
    Defaults to @samp{"30 secs"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean mail-save-crlf?
    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.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean maildir-stat-dirs?
    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).
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean maildir-copy-with-hardlinks?
    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.
    Defaults to @samp{#t}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean maildir-very-dirty-syncs?
    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.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mbox-read-locks
    Which locking methods to use for locking mbox.  There are four
    available:
    
    @table @code
    @item dotlock
    Create <mailbox>.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.
    
    Andy Wingo's avatar
    Andy Wingo committed
    9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538
    @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.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mbox-write-locks
    
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mbox-lock-timeout
    Maximum time to wait for lock (all of them) before aborting.
    Defaults to @samp{"5 mins"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mbox-dotlock-change-timeout
    If dotlock exists but the mailbox isn't modified in any way,
    override the lock file after this much time.
    Defaults to @samp{"2 mins"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean mbox-dirty-syncs?
    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.
    Defaults to @samp{#t}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean mbox-very-dirty-syncs?
    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.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean mbox-lazy-writes?
    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.
    Defaults to @samp{#t}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mbox-min-index-size
    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.
    Defaults to @samp{0}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mdbox-rotate-size
    Maximum dbox file size until it's rotated.
    Defaults to @samp{2000000}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mdbox-rotate-interval
    Maximum dbox file age until it's rotated.  Typically in days.  Day
    begins from midnight, so 1d = today, 2d = yesterday, etc.  0 = check
    disabled.
    Defaults to @samp{"1d"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean mdbox-preallocate-space?
    When creating new mdbox files, immediately preallocate their size to
    @samp{mdbox-rotate-size}.  This setting currently works only in Linux
    with some filesystems (ext4, xfs).
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mail-attachment-dir
    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.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mail-attachment-min-size
    Attachments smaller than this aren't saved externally.  It's also
    possible to write a plugin to disable saving specific attachments
    externally.
    Defaults to @samp{128000}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mail-attachment-fs
    Filesystem 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
    Defaults to @samp{"sis posix"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string mail-attachment-hash
    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.
    Defaults to @samp{"%@{sha1@}"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer default-process-limit
    
    Defaults to @samp{100}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer default-client-limit
    
    Defaults to @samp{1000}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer default-vsz-limit
    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.
    Defaults to @samp{256000000}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string default-login-user
    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.
    Defaults to @samp{"dovenull"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string default-internal-user
    Internal user is used by unprivileged processes.  It should be
    separate from login user, so that login processes can't disturb other
    processes.
    Defaults to @samp{"dovecot"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl?
    SSL/TLS support: yes, no, required.  <doc/wiki/SSL.txt>.
    Defaults to @samp{"required"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-cert
    PEM encoded X.509 SSL/TLS certificate (public key).
    Defaults to @samp{"</etc/dovecot/default.pem"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-key
    PEM encoded SSL/TLS private key.  The key is opened before
    dropping root privileges, so keep the key file unreadable by anyone but
    root.
    Defaults to @samp{"</etc/dovecot/private/default.pem"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-key-password
    If key file is password protected, give the password here.
    Alternatively give it when starting dovecot with -p parameter.  Since
    this file is often world-readable, you may want to place this setting
    instead to a different.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-ca
    PEM encoded trusted certificate authority.  Set this only if you
    intend to use @samp{ssl-verify-client-cert? #t}.  The file should
    contain the CA certificate(s) followed by the matching
    CRL(s).  (e.g. @samp{ssl-ca </etc/ssl/certs/ca.pem}).
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean ssl-require-crl?
    Require that CRL check succeeds for client certificates.
    Defaults to @samp{#t}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean ssl-verify-client-cert?
    Request client to send a certificate.  If you also want to require
    it, set @samp{auth-ssl-require-client-cert? #t} in auth section.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-cert-username-field
    Which field from certificate to use for username.  commonName and
    x500UniqueIdentifier are the usual choices.  You'll also need to set
    @samp{auth-ssl-username-from-cert? #t}.
    Defaults to @samp{"commonName"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} hours ssl-parameters-regenerate
    How often to regenerate the SSL parameters file.  Generation is
    quite CPU intensive operation.  The value is in hours, 0 disables
    regeneration entirely.
    Defaults to @samp{168}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-protocols
    SSL protocols to use.
    Defaults to @samp{"!SSLv2"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-cipher-list
    SSL ciphers to use.
    Defaults to @samp{"ALL:!LOW:!SSLv2:!EXP:!aNULL"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string ssl-crypto-device
    SSL crypto device to use, for valid values run "openssl engine".
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string postmaster-address
    Address to use when sending rejection mails.
    Default is postmaster@@<your domain>.  %d expands to recipient domain.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string hostname
    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.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean quota-full-tempfail?
    If user is over quota, return with temporary failure instead of
    bouncing the mail.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} file-name sendmail-path
    Binary to use for sending mails.
    Defaults to @samp{"/usr/sbin/sendmail"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string submission-host
    If non-empty, send mails via this SMTP host[:port] instead of
    sendmail.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string rejection-subject
    Subject: header to use for rejection mails.  You can use the same
    variables as for @samp{rejection-reason} below.
    Defaults to @samp{"Rejected: %s"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string rejection-reason
    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
    Defaults to @samp{"Your message to <%t> was automatically rejected:%n%r"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string recipient-delimiter
    Delimiter character between local-part and detail in email
    address.
    Defaults to @samp{"+"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string lda-original-recipient-header
    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.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean lda-mailbox-autocreate?
    Should saving a mail to a nonexistent mailbox automatically create
    it?.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} boolean lda-mailbox-autosubscribe?
    Should automatically created mailboxes be also automatically
    subscribed?.
    Defaults to @samp{#f}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} non-negative-integer imap-max-line-length
    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.
    Defaults to @samp{64000}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string imap-logout-format
    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
    Defaults to @samp{"in=%i out=%o"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string imap-capability
    Override the IMAP CAPABILITY response.  If the value begins with '+',
    add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string imap-idle-notify-interval
    How long to wait between "OK Still here" notifications when client
    is IDLEing.
    Defaults to @samp{"2 mins"}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string imap-id-send
    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.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string imap-id-log
    ID fields sent by client to log.  * means everything.
    Defaults to @samp{""}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list imap-client-workarounds
    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 (<v2.1).  Outlook Express breaks more badly though, without this it
    may show user "Message no longer in server" errors.  Note that OE6
    still breaks even with this workaround if synchronization is set to
    "Headers Only".
    
    @item tb-extra-mailbox-sep
    Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
    adds extra @samp{/} suffixes to mailbox names.  This option causes Dovecot to
    ignore the extra @samp{/} instead of treating it as invalid mailbox name.
    
    @item tb-lsub-flags
    Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
    This makes Thunderbird realize they aren't selectable and show them
    greyed out, instead of only later giving "not selectable" popup error.
    @end table
    Defaults to @samp{()}.
    @end deftypevr
    
    @deftypevr {@code{dovecot-configuration} parameter} string imap-urlauth-host
    Host allowed in URLAUTH URLs sent by client.  "*" allows all.
    Defaults to @samp{""}.
    @end deftypevr
    
    
    Whew!  Lots of configuration options.  The nice thing about it though is
    that GuixSD has a complete interface to Dovecot's configuration
    language.  This allows not only a nice way to declare configurations,
    but also offers reflective capabilities as well: users can write code to
    inspect and transform configurations from within Scheme.
    
    However, it could be that you just want to get a @code{dovecot.conf} up
    and running.  In that case, you can pass an
    @code{opaque-dovecot-configuration} as the @code{#:config} paramter to
    @code{dovecot-service}.  As its name indicates, an opaque configuration
    does not have easy reflective capabilities.
    
    Available @code{opaque-dovecot-configuration} fields are:
    
    @deftypevr {@code{opaque-dovecot-configuration} parameter} package dovecot
    The dovecot package.
    @end deftypevr
    
    @deftypevr {@code{opaque-dovecot-configuration} parameter} string string
    The contents of the @code{dovecot.conf}, as a string.
    @end deftypevr
    
    For example, if your @code{dovecot.conf} is just the empty string, you
    could instantiate a dovecot service like this:
    
    @example
    (dovecot-service #:config
                     (opaque-dovecot-configuration
                      (string "")))
    @end example
    
    
    @node Web Services
    @subsubsection Web Services
    
    The @code{(gnu services web)} module provides the following service:
    
    
    @deffn {Scheme Procedure} nginx-service [#:nginx nginx] @
    
           [#:log-directory ``/var/log/nginx''] @
           [#:run-directory ``/var/run/nginx''] @
           [#:config-file]
    
    Return a service that runs @var{nginx}, the nginx web server.
    
    The nginx daemon loads its runtime configuration from @var{config-file}.
    Log files are written to @var{log-directory} and temporary runtime data
    files are written to @var{run-directory}.  For proper operation, these
    arguments should match what is in @var{config-file} to ensure that the
    directories are created when the service is activated.
    
    @end deffn
    
    
    @node Various Services
    @subsubsection Various Services
    
    The @code{(gnu services lirc)} module provides the following service.
    
    
    @deffn {Scheme Procedure} lirc-service [#:lirc lirc] @
    
           [#:device #f] [#:driver #f] [#:config-file #f] @
           [#:extra-options '()]
    Return a service that runs @url{http://www.lirc.org,LIRC}, a daemon that
    decodes infrared signals from remote controls.
    
    Optionally, @var{device}, @var{driver} and @var{config-file}
    (configuration file name) may be specified.  See @command{lircd} manual
    for details.
    
    Finally, @var{extra-options} is a list of additional command-line options
    passed to @command{lircd}.
    @end deffn
    
    
    @subsubsection Dictionary Services
    The @code{(gnu services dict)} module provides the following service:
    
    @deffn {Scheme Procedure} dicod-service [#:config (dicod-configuration)]
    Return a service that runs the @command{dicod} daemon, an implementation
    of DICT server (@pxref{Dicod,,, dico, GNU Dico Manual}).
    
    The optional @var{config} argument specifies the configuration for
    @command{dicod}, which should be a @code{<dicod-configuration>} object, by
    default it serves the GNU Collaborative International Dictonary of English.
    
    You can add @command{open localhost} to your @file{~/.dico} file to make
    @code{localhost} the default server for @command{dico} client
    (@pxref{Initialization File,,, dico, GNU Dico Manual}).
    @end deffn
    
    @deftp {Data Type} dicod-configuration
    Data type representing the configuration of dicod.
    
    @table @asis
    @item @code{dico} (default: @var{dico})
    Package object of the GNU Dico dictionary server.
    
    
    @item @code{interfaces} (default: @var{'("localhost")})
    This is the list of IP addresses and ports and possibly socket file
    names to listen to (@pxref{Server Settings, @code{listen} directive,,
    dico, GNU Dico Manual}).
    
    
    @item @code{databases} (default: @var{(list %dicod-database:gcide)})
    List of @code{<dicod-database>} objects denoting dictionaries to be served.
    @end table
    @end deftp
    
    @deftp {Data Type} dicod-database
    Data type representing a dictionary database.
    
    @table @asis
    @item @code{name}
    Name of the database, will be used in DICT commands.
    
    @item @code{module}
    Name of the dicod module used by this database
    (@pxref{Modules,,, dico, GNU Dico Manual}).
    
    @item @code{options}
    List of strings or gexps representing the arguments for the module handler
    (@pxref{Handlers,,, dico, GNU Dico Manual}).
    @end table
    @end deftp
    
    @defvr {Scheme Variable} %dicod-database:gcide
    A @code{<dicod-database>} object serving the GNU Collaborative International
    Dictonary of English using the @code{gcide} package.
    @end defvr
    
    @node Setuid Programs
    @subsection Setuid Programs
    
    @cindex setuid programs
    Some programs need to run with ``root'' privileges, even when they are
    launched by unprivileged users.  A notorious example is the
    
    @command{passwd} program, which users can run to change their
    password, and which needs to access the @file{/etc/passwd} and
    
    @file{/etc/shadow} files---something normally restricted to root, for
    obvious security reasons.  To address that, these executables are
    @dfn{setuid-root}, meaning that they always run with root privileges
    (@pxref{How Change Persona,,, libc, The GNU C Library Reference Manual},
    
    for more info about the setuid mechanism.)
    
    
    The store itself @emph{cannot} contain setuid programs: that would be a
    security issue since any user on the system can write derivations that
    populate the store (@pxref{The Store}).  Thus, a different mechanism is
    used: instead of changing the setuid bit directly on files that are in
    the store, we let the system administrator @emph{declare} which programs
    should be setuid root.
    
    The @code{setuid-programs} field of an @code{operating-system}
    declaration contains a list of G-expressions denoting the names of
    programs to be setuid-root (@pxref{Using the Configuration System}).
    For instance, the @command{passwd} program, which is part of the Shadow
    package, can be designated by this G-expression (@pxref{G-Expressions}):
    
    @example
    #~(string-append #$shadow "/bin/passwd")
    @end example
    
    A default set of setuid programs is defined by the
    @code{%setuid-programs} variable of the @code{(gnu system)} module.
    
    @defvr {Scheme Variable} %setuid-programs
    A list of G-expressions denoting common programs that are setuid-root.
    
    The list includes commands such as @command{passwd}, @command{ping},
    @command{su}, and @command{sudo}.
    @end defvr
    
    Under the hood, the actual setuid programs are created in the
    @file{/run/setuid-programs} directory at system activation time.  The
    files in this directory refer to the ``real'' binaries, which are in the
    store.
    
    
    @node X.509 Certificates
    @subsection X.509 Certificates
    
    @cindex HTTPS, certificates
    @cindex X.509 certificates
    @cindex TLS
    Web servers available over HTTPS (that is, HTTP over the transport-layer
    security mechanism, TLS) send client programs an @dfn{X.509 certificate}
    that the client can then use to @emph{authenticate} the server.  To do
    that, clients verify that the server's certificate is signed by a
    so-called @dfn{certificate authority} (CA).  But to verify the CA's
    signature, clients must have first acquired the CA's certificate.
    
    Web browsers such as GNU@tie{}IceCat include their own set of CA
    certificates, such that they are able to verify CA signatures
    out-of-the-box.
    
    However, most other programs that can talk HTTPS---@command{wget},
    @command{git}, @command{w3m}, etc.---need to be told where CA
    certificates can be found.
    
    @cindex @code{nss-certs}
    In GuixSD, this is done by adding a package that provides certificates
    to the @code{packages} field of the @code{operating-system} declaration
    (@pxref{operating-system Reference}).  GuixSD includes one such package,
    @code{nss-certs}, which is a set of CA certificates provided as part of
    Mozilla's Network Security Services.
    
    Note that it is @emph{not} part of @var{%base-packages}, so you need to
    explicitly add it.  The @file{/etc/ssl/certs} directory, which is where
    most applications and libraries look for certificates by default, points
    to the certificates installed globally.
    
    
    Unprivileged users, including users of Guix on a foreign distro,
    can also install their own certificate package in
    
    their profile.  A number of environment variables need to be defined so
    that applications and libraries know where to find them.  Namely, the
    OpenSSL library honors the @code{SSL_CERT_DIR} and @code{SSL_CERT_FILE}
    variables.  Some applications add their own environment variables; for
    instance, the Git version control system honors the certificate bundle
    
    pointed to by the @code{GIT_SSL_CAINFO} environment variable.  Thus, you
    would typically run something like:
    
    @example
    $ guix package -i nss-certs
    $ export SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
    $ export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
    $ export GIT_SSL_CAINFO="$SSL_CERT_FILE"
    @end example
    
    @node Name Service Switch
    @subsection Name Service Switch
    
    @cindex name service switch
    @cindex NSS
    The @code{(gnu system nss)} module provides bindings to the
    
    configuration file of the libc @dfn{name service switch} or @dfn{NSS}
    
    (@pxref{NSS Configuration File,,, libc, The GNU C Library Reference
    Manual}).  In a nutshell, the NSS is a mechanism that allows libc to be
    extended with new ``name'' lookup methods for system databases, which
    includes host names, service names, user accounts, and more (@pxref{Name
    Service Switch, System Databases and Name Service Switch,, libc, The GNU
    C Library Reference Manual}).
    
    The NSS configuration specifies, for each system database, which lookup
    method is to be used, and how the various methods are chained
    together---for instance, under which circumstances NSS should try the
    next method in the list.  The NSS configuration is given in the
    @code{name-service-switch} field of @code{operating-system} declarations
    (@pxref{operating-system Reference, @code{name-service-switch}}).
    
    
    @cindex nss-mdns
    @cindex .local, host name lookup
    
    As an example, the declaration below configures the NSS to use the
    
    @uref{http://0pointer.de/lennart/projects/nss-mdns/, @code{nss-mdns}
    back-end}, which supports host name lookups over multicast DNS (mDNS)
    for host names ending in @code{.local}:
    
    
    @example
    (name-service-switch
       (hosts (list %files    ;first, check /etc/hosts
    
                    ;; If the above did not succeed, try
                    ;; with 'mdns_minimal'.
                    (name-service
                      (name "mdns_minimal")
    
                      ;; 'mdns_minimal' is authoritative for
                      ;; '.local'.  When it returns "not found",
                      ;; no need to try the next methods.
                      (reaction (lookup-specification
                                 (not-found => return))))
    
                    ;; Then fall back to DNS.
                    (name-service
                      (name "dns"))
    
                    ;; Finally, try with the "full" 'mdns'.
                    (name-service
                      (name "mdns")))))
    @end example
    
    
    Do not worry: the @code{%mdns-host-lookup-nss} variable (see below)
    contains this configuration, so you will not have to type it if all you
    
    want is to have @code{.local} host lookup working.
    
    
    Note that, in this case, in addition to setting the
    @code{name-service-switch} of the @code{operating-system} declaration,
    
    you also need to use @code{avahi-service} (@pxref{Networking Services,
    @code{avahi-service}}), or @var{%desktop-services}, which includes it
    (@pxref{Desktop Services}).  Doing this makes @code{nss-mdns} accessible
    to the name service cache daemon (@pxref{Base Services,
    @code{nscd-service}}).
    
    
    For convenience, the following variables provide typical NSS
    configurations.
    
    @defvr {Scheme Variable} %default-nss
    This is the default name service switch configuration, a
    @code{name-service-switch} object.
    @end defvr
    
    @defvr {Scheme Variable} %mdns-host-lookup-nss
    This is the name service switch configuration with support for host name
    lookup over multicast DNS (mDNS) for host names ending in @code{.local}.
    @end defvr
    
    The reference for name service switch configuration is given below.  It
    
    is a direct mapping of the configuration file format of the C library , so
    
    please refer to the C library manual for more information (@pxref{NSS
    Configuration File,,, libc, The GNU C Library Reference Manual}).
    
    Compared to the configuration file format of libc NSS, it has the advantage
    
    not only of adding this warm parenthetic feel that we like, but also
    
    static checks: you will know about syntax errors and typos as soon as you
    
    run @command{guix system}.
    
    @deftp {Data Type} name-service-switch
    
    This is the data type representation the configuration of libc's name
    service switch (NSS).  Each field below represents one of the supported
    system databases.
    
    @table @code
    @item aliases
    @itemx ethers
    @itemx group
    @itemx gshadow
    @itemx hosts
    @itemx initgroups
    @itemx netgroup
    @itemx networks
    @itemx password
    @itemx public-key
    @itemx rpc
    @itemx services
    @itemx shadow
    The system databases handled by the NSS.  Each of these fields must be a
    
    list of @code{<name-service>} objects (see below).
    
    @end table
    @end deftp
    
    @deftp {Data Type} name-service
    
    This is the data type representing an actual name service and the
    associated lookup action.
    
    @table @code
    @item name
    A string denoting the name service (@pxref{Services in the NSS
    configuration,,, libc, The GNU C Library Reference Manual}).
    
    
    Note that name services listed here must be visible to nscd.  This is
    achieved by passing the @code{#:name-services} argument to
    @code{nscd-service} the list of packages providing the needed name
    services (@pxref{Base Services, @code{nscd-service}}).
    
    
    @item reaction
    An action specified using the @code{lookup-specification} macro
    (@pxref{Actions in the NSS configuration,,, libc, The GNU C Library
    Reference Manual}).  For example:
    
    @example
    (lookup-specification (unavailable => continue)
                          (success => return))
    @end example
    @end table
    @end deftp
    
    @node Initial RAM Disk
    @subsection Initial RAM Disk
    
    @cindex initial RAM disk (initrd)
    @cindex initrd (initial RAM disk)
    For bootstrapping purposes, the Linux-Libre kernel is passed an
    @dfn{initial RAM disk}, or @dfn{initrd}.  An initrd contains a temporary
    
    root file system as well as an initialization script.  The latter is
    
    responsible for mounting the real root file system, and for loading any
    kernel modules that may be needed to achieve that.
    
    The @code{initrd} field of an @code{operating-system} declaration allows
    you to specify which initrd you would like to use.  The @code{(gnu
    system linux-initrd)} module provides two ways to build an initrd: the
    high-level @code{base-initrd} procedure, and the low-level
    @code{expression->initrd} procedure.
    
    The @code{base-initrd} procedure is intended to cover most common uses.
    For example, if you want to add a bunch of kernel modules to be loaded
    at boot time, you can define the @code{initrd} field of the operating
    system declaration like this:
    
    @example
    
    (initrd (lambda (file-systems . rest)
    
              ;; Create a standard initrd that has modules "foo.ko"
              ;; and "bar.ko", as well as their dependencies, in
              ;; addition to the modules available by default.
    
                     #:extra-modules '("foo" "bar")
    
    The @code{base-initrd} procedure also handles common use cases that
    
    involves using the system as a QEMU guest, or as a ``live'' system with
    volatile root file system.
    
    The initial RAM disk produced by @code{base-initrd} honors several
    options passed on the Linux kernel command line (that is, arguments
    
    passed @i{via} the @code{linux} command of GRUB, or the
    @code{-append} option) of QEMU, notably:
    
    
    @table @code
    @item --load=@var{boot}
    Tell the initial RAM disk to load @var{boot}, a file containing a Scheme
    program, once it has mounted the root file system.
    
    GuixSD uses this option to yield control to a boot program that runs the
    
    service activation programs and then spawns the GNU@tie{}Shepherd, the
    
    initialization system.
    
    @item --root=@var{root}
    
    Mount @var{root} as the root file system.  @var{root} can be a
    
    device name like @code{/dev/sda1}, a partition label, or a partition
    UUID.
    
    @item --system=@var{system}
    Have @file{/run/booted-system} and @file{/run/current-system} point to
    @var{system}.
    
    @item modprobe.blacklist=@var{modules}@dots{}
    @cindex module, black-listing
    @cindex black list, of kernel modules
    Instruct the initial RAM disk as well as the @command{modprobe} command
    (from the kmod package) to refuse to load @var{modules}.  @var{modules}
    must be a comma-separated list of module names---e.g.,
    @code{usbkbd,9pnet}.
    
    @item --repl
    Start a read-eval-print loop (REPL) from the initial RAM disk before it
    tries to load kernel modules and to mount the root file system.  Our
    marketing team calls it @dfn{boot-to-Guile}.  The Schemer in you will
    love it.  @xref{Using Guile Interactively,,, guile, GNU Guile Reference
    Manual}, for more information on Guile's REPL.
    
    @end table
    
    Now that you know all the features that initial RAM disks produced by
    @code{base-initrd} provide, here is how to use it and customize it
    further.
    
    
    @deffn {Monadic Procedure} base-initrd @var{file-systems} @
    
           [#:qemu-networking? #f] [#:virtio? #t] [#:volatile-root? #f] @
    
           [#:extra-modules '()] [#:mapped-devices '()]
    
    Return a monadic derivation that builds a generic initrd.  @var{file-systems} is
    
    a list of file systems to be mounted by the initrd, possibly in addition to
    
    the root file system specified on the kernel command line via @code{--root}.
    
    @var{mapped-devices} is a list of device mappings to realize before
    @var{file-systems} are mounted (@pxref{Mapped Devices}).
    
    
    When @var{qemu-networking?} is true, set up networking with the standard QEMU
    
    parameters.  When @var{virtio?} is true, load additional modules so that the
    initrd can be used as a QEMU guest with para-virtualized I/O drivers.
    
    
    When @var{volatile-root?} is true, the root file system is writable but any changes
    to it are lost.
    
    The initrd is automatically populated with all the kernel modules necessary
    for @var{file-systems} and for the given options.  However, additional kernel
    modules can be listed in @var{extra-modules}.  They will be added to the initrd, and
    loaded at boot time in the order in which they appear.
    @end deffn
    
    Needless to say, the initrds we produce and use embed a
    statically-linked Guile, and the initialization program is a Guile
    program.  That gives a lot of flexibility.  The
    @code{expression->initrd} procedure builds such an initrd, given the
    program to run in that initrd.
    
    @deffn {Monadic Procedure} expression->initrd @var{exp} @
           [#:guile %guile-static-stripped] [#:name "guile-initrd"] @
    
    Return a derivation that builds a Linux initrd (a gzipped cpio archive)
    containing @var{guile} and that evaluates @var{exp}, a G-expression,
    
    upon booting.  All the derivations referenced by @var{exp} are
    automatically copied to the initrd.
    
    @var{modules} is a list of Guile module names to be embedded in the
    initrd.
    
    @node GRUB Configuration
    @subsection GRUB Configuration
    
    @cindex GRUB
    @cindex boot loader
    
    The operating system uses GNU@tie{}GRUB as its boot loader
    (@pxref{Overview, overview of GRUB,, grub, GNU GRUB Manual}).  It is
    
    configured using a @code{grub-configuration} declaration.  This data type
    is exported by the @code{(gnu system grub)} module and described below.
    
    
    @deftp {Data Type} grub-configuration
    The type of a GRUB configuration declaration.