Skip to content
Snippets Groups Projects
guix.texi 828 KiB
Newer Older
  • Learn to ignore specific revisions
  • This procedure can be called several times, one for each network
    interface of interest.  Behind the scenes what it does is extend
    @code{static-networking-service-type} with additional network interfaces
    to handle.
    
    @cindex wicd
    
    @cindex wireless
    @cindex WiFi
    
    @cindex network management
    
    @deffn {Scheme Procedure} wicd-service [#:wicd @var{wicd}]
    
    Return a service that runs @url{https://launchpad.net/wicd,Wicd}, a network
    management daemon that aims to simplify wired and wireless networking.
    
    This service adds the @var{wicd} package to the global profile, providing
    several commands to interact with the daemon and configure networking:
    @command{wicd-client}, a graphical user interface, and the @command{wicd-cli}
    and @command{wicd-curses} user interfaces.
    
    @cindex ModemManager
    
    @defvr {Scheme Variable} modem-manager-service-type
    This is the service type for the
    @uref{https://wiki.gnome.org/Projects/ModemManager, ModemManager}
    service. The value for this service type is a
    @code{modem-manager-configuration} record.
    
    This service is part of @code{%desktop-services} (@pxref{Desktop
    Services}).
    @end defvr
    
    @deftp {Data Type} modem-manager-configuration
    Data type representing the configuration of ModemManager.
    
    @table @asis
    @item @code{modem-manager} (default: @code{modem-manager})
    The ModemManager package to use.
    
    @end table
    @end deftp
    
    
    @cindex NetworkManager
    
    
    @defvr {Scheme Variable} network-manager-service-type
    This is the service type for the
    @uref{https://wiki.gnome.org/Projects/NetworkManager, NetworkManager}
    service. The value for this service type is a
    @code{network-manager-configuration} record.
    
    
    This service is part of @code{%desktop-services} (@pxref{Desktop
    Services}).
    
    @end defvr
    
    @deftp {Data Type} network-manager-configuration
    Data type representing the configuration of NetworkManager.
    
    @table @asis
    @item @code{network-manager} (default: @code{network-manager})
    The NetworkManager package to use.
    
    @item @code{dns} (default: @code{"default"})
    Processing mode for DNS, which affects how NetworkManager uses the
    @code{resolv.conf} configuration file.
    
    @table @samp
    @item default
    NetworkManager will update @code{resolv.conf} to reflect the nameservers
    provided by currently active connections.
    
    @item dnsmasq
    NetworkManager will run @code{dnsmasq} as a local caching nameserver,
    using a "split DNS" configuration if you are connected to a VPN, and
    then update @code{resolv.conf} to point to the local nameserver.
    
    @item none
    NetworkManager will not modify @code{resolv.conf}.
    @end table
    
    
    @item @code{vpn-plugins} (default: @code{'()})
    This is the list of available plugins for virtual private networks
    (VPNs).  An example of this is the @code{network-manager-openvpn}
    package, which allows NetworkManager to manage VPNs @i{via} OpenVPN.
    
    
    @cindex Connman
    
    @deffn {Scheme Variable} connman-service-type
    This is the service type to run @url{https://01.org/connman,Connman},
    a network connection manager.
    
    Its value must be an
    @code{connman-configuration} record as in this example:
    
    @example
    (service connman-service-type
             (connman-configuration
               (disable-vpn? #t)))
    @end example
    
    See below for details about @code{connman-configuration}.
    
    @deftp {Data Type} connman-configuration
    Data Type representing the configuration of connman.
    
    @table @asis
    @item @code{connman} (default: @var{connman})
    The connman package to use.
    
    @item @code{disable-vpn?} (default: @code{#f})
    When true, enable connman's vpn plugin.
    @end table
    @end deftp
    
    
    @cindex WPA Supplicant
    
    @defvr {Scheme Variable} wpa-supplicant-service-type
    This is the service type to run @url{https://w1.fi/wpa_supplicant/,WPA
    
    supplicant}, an authentication daemon required to authenticate against
    
    encrypted WiFi or ethernet networks.  It is configured to listen for
    
    requests on D-Bus.
    
    
    The value of this service is the @code{wpa-supplicant} package to use.
    Thus, it can be instantiated like this:
    
    @lisp
    
    (use-modules (gnu services networking))
    
    (service wpa-supplicant-service-type)
    
    @cindex NTP
    @cindex real time clock
    
    @deffn {Scheme Procedure} ntp-service [#:ntp @var{ntp}] @
    
      [#:servers @var{%ntp-servers}] @
      [#:allow-large-adjustment? #f]
    
    Return a service that runs the daemon from @var{ntp}, the
    @uref{http://www.ntp.org, Network Time Protocol package}.  The daemon will
    keep the system clock synchronized with that of @var{servers}.
    
    @var{allow-large-adjustment?} determines whether @command{ntpd} is allowed to
    make an initial adjustment of more than 1,000 seconds.
    
    @end deffn
    
    @defvr {Scheme Variable} %ntp-servers
    List of host names used as the default NTP servers.
    @end defvr
    
    
    @cindex OpenNTPD
    @deffn {Scheme Procedure} openntpd-service-type
    Run the @command{ntpd}, the Network Time Protocol (NTP) daemon, as implemented
    by @uref{http://www.openntpd.org, OpenNTPD}.  The daemon will keep the system
    clock synchronized with that of the given servers.
    
    @example
    (service
     openntpd-service-type
     (openntpd-configuration
      (listen-on '("127.0.0.1" "::1"))
      (sensor '("udcf0 correction 70000"))
      (constraint-from '("www.gnu.org"))
      (constraints-from '("https://www.google.com/"))
      (allow-large-adjustment? #t)))
    
    @end example
    @end deffn
    
    @deftp {Data Type} openntpd-configuration
    @table @asis
    @item @code{openntpd} (default: @code{(file-append openntpd "/sbin/ntpd")})
    The openntpd executable to use.
    @item @code{listen-on} (default: @code{'("127.0.0.1" "::1")})
    A list of local IP addresses or hostnames the ntpd daemon should listen on.
    @item @code{query-from} (default: @code{'()})
    A list of local IP address the ntpd daemon should use for outgoing queries.
    @item @code{sensor} (default: @code{'()})
    Specify a list of timedelta sensor devices ntpd should use.  @code{ntpd}
    will listen to each sensor that acutally exists and ignore non-existant ones.
    See @uref{https://man.openbsd.org/ntpd.conf, upstream documentation} for more
    information.
    @item @code{server} (default: @var{%ntp-servers})
    Specify a list of IP addresses or hostnames of NTP servers to synchronize to.
    @item @code{servers} (default: @code{'()})
    Specify a list of IP addresses or hostnames of NTP pools to synchronize to.
    @item @code{constraint-from} (default: @code{'()})
    @code{ntpd} can be configured to query the ‘Date’ from trusted HTTPS servers via TLS.
    This time information is not used for precision but acts as an authenticated
    constraint, thereby reducing the impact of unauthenticated NTP
    man-in-the-middle attacks.
    Specify a list of URLs, IP addresses or hostnames of HTTPS servers to provide
    a constraint.
    @item @code{constraints-from} (default: @code{'()})
    As with constraint from, specify a list of URLs, IP addresses or hostnames of
    HTTPS servers to provide a constraint.  Should the hostname resolve to multiple
    IP addresses, @code{ntpd} will calculate a median constraint from all of them.
    @item @code{allow-large-adjustment?} (default: @code{#f})
    Determines if @code{ntpd} is allowed to make an initial adjustment of more
    than 180 seconds.
    @end table
    @end deftp
    
    
    @cindex inetd
    @deffn {Scheme variable} inetd-service-type
    This service runs the @command{inetd} (@pxref{inetd invocation,,,
    inetutils, GNU Inetutils}) daemon.  @command{inetd} listens for
    connections on internet sockets, and lazily starts the specified server
    program when a connection is made on one of these sockets.
    
    The value of this service is an @code{inetd-configuration} object.  The
    following example configures the @command{inetd} daemon to provide the
    built-in @command{echo} service, as well as an smtp service which
    forwards smtp traffic over ssh to a server @code{smtp-server} behind a
    gateway @code{hostname}:
    
    @example
    (service
     inetd-service-type
     (inetd-configuration
      (entries (list
                (inetd-entry
                 (name "echo")
                 (socket-type 'stream)
                 (protocol "tcp")
                 (wait? #f)
                 (user "root"))
                (inetd-entry
                 (node "127.0.0.1")
                 (name "smtp")
                 (socket-type 'stream)
                 (protocol "tcp")
                 (wait? #f)
                 (user "root")
                 (program (file-append openssh "/bin/ssh"))
                 (arguments
                  '("ssh" "-qT" "-i" "/path/to/ssh_key"
                    "-W" "smtp-server:25" "user@@hostname")))))
    @end example
    
    See below for more details about @code{inetd-configuration}.
    @end deffn
    
    @deftp {Data Type} inetd-configuration
    Data type representing the configuration of @command{inetd}.
    
    @table @asis
    @item @code{program} (default: @code{(file-append inetutils "/libexec/inetd")})
    The @command{inetd} executable to use.
    
    @item @code{entries} (default: @code{'()})
    A list of @command{inetd} service entries.  Each entry should be created
    by the @code{inetd-entry} constructor.
    @end table
    @end deftp
    
    @deftp {Data Type} inetd-entry
    Data type representing an entry in the @command{inetd} configuration.
    Each entry corresponds to a socket where @command{inetd} will listen for
    requests.
    
    @table @asis
    @item @code{node} (default: @code{#f})
    Optional string, a comma-separated list of local addresses
    @command{inetd} should use when listening for this service.
    @xref{Configuration file,,, inetutils, GNU Inetutils} for a complete
    description of all options.
    @item @code{name}
    A string, the name must correspond to an entry in @code{/etc/services}.
    @item @code{socket-type}
    One of @code{'stream}, @code{'dgram}, @code{'raw}, @code{'rdm} or
    @code{'seqpacket}.
    @item @code{protocol}
    A string, must correspond to an entry in @code{/etc/protocols}.
    @item @code{wait?} (default: @code{#t})
    Whether @command{inetd} should wait for the server to exit before
    listening to new service requests.
    @item @code{user}
    A string containing the user (and, optionally, group) name of the user
    as whom the server should run.  The group name can be specified in a
    suffix, separated by a colon or period, i.e. @code{"user"},
    @code{"user:group"} or @code{"user.group"}.
    @item @code{program} (default: @code{"internal"})
    The server program which will serve the requests, or @code{"internal"}
    if @command{inetd} should use a built-in service.
    @item @code{arguments} (default: @code{'()})
    A list strings or file-like objects, which are the server program's
    arguments, starting with the zeroth argument, i.e. the name of the
    program itself.  For @command{inetd}'s internal services, this entry
    must be @code{'()} or @code{'("internal")}.
    @end table
    
    @xref{Configuration file,,, inetutils, GNU Inetutils} for a more
    detailed discussion of each configuration field.
    @end deftp
    
    
    @cindex Tor
    
    @deffn {Scheme Procedure} tor-service [@var{config-file}] [#:tor @var{tor}]
    Return a service to run the @uref{https://torproject.org, Tor} anonymous
    networking daemon.
    
    The daemon runs as the @code{tor} unprivileged user.  It is passed
    
    @var{config-file}, a file-like object, with an additional @code{User tor} line
    and lines for hidden services added via @code{tor-hidden-service}.  Run
    @command{man tor} for information about the configuration file.
    @end deffn
    
    
    @cindex hidden service
    
    @deffn {Scheme Procedure} tor-hidden-service @var{name} @var{mapping}
    Define a new Tor @dfn{hidden service} called @var{name} and implementing
    @var{mapping}.  @var{mapping} is a list of port/host tuples, such as:
    
    @example
    
     '((22 "127.0.0.1:22")
       (80 "127.0.0.1:8080"))
    
    @end example
    
    In this example, port 22 of the hidden service is mapped to local port 22, and
    port 80 is mapped to local port 8080.
    
    
    This creates a @file{/var/lib/tor/hidden-services/@var{name}} directory, where
    the @file{hostname} file contains the @code{.onion} host name for the hidden
    
    service.
    
    See @uref{https://www.torproject.org/docs/tor-hidden-service.html.en, the Tor
    project's documentation} for more information.
    
    Oleg Pykhalov's avatar
    Oleg Pykhalov committed
    The @code{(gnu services rsync)} module provides the following services:
    
    You might want an rsync daemon if you have files that you want available
    so anyone (or just yourself) can download existing files or upload new
    files.
    
    @deffn {Scheme Variable} rsync-service-type
    This is the type for the @uref{https://rsync.samba.org, rsync} rsync daemon,
    @command{rsync-configuration} record as in this example:
    
    @example
    (service rsync-service-type)
    @end example
    
    See below for details about @code{rsync-configuration}.
    @end deffn
    
    @deftp {Data Type} rsync-configuration
    Data type representing the configuration for @code{rsync-service}.
    
    @table @asis
    @item @code{package} (default: @var{rsync})
    @code{rsync} package to use.
    
    @item @code{port-number} (default: @code{873})
    TCP port on which @command{rsync} listens for incoming connections.  If port
    is less than @code{1024} @command{rsync} needs to be started as the
    @code{root} user and group.
    
    @item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
    Name of the file where @command{rsync} writes its PID.
    
    @item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
    Name of the file where @command{rsync} writes its lock file.
    
    @item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
    Name of the file where @command{rsync} writes its log file.
    
    @item @code{use-chroot?} (default: @var{#t})
    Whether to use chroot for @command{rsync} shared directory.
    
    @item @code{share-path} (default: @file{/srv/rsync})
    Location of the @command{rsync} shared directory.
    
    @item @code{share-comment} (default: @code{"Rsync share"})
    Comment of the @command{rsync} shared directory.
    
    @item @code{read-only?} (default: @var{#f})
    Read-write permissions to shared directory.
    
    @item @code{timeout} (default: @code{300})
    I/O timeout in seconds.
    
    @item @code{user} (default: @var{"root"})
    Owner of the @code{rsync} process.
    
    @item @code{group} (default: @var{"root"})
    Group of the @code{rsync} process.
    
    @item @code{uid} (default: @var{"rsyncd"})
    User name or user ID that file transfers to and from that module should take
    place as when the daemon was run as @code{root}.
    
    @item @code{gid} (default: @var{"rsyncd"})
    Group name or group ID that will be used when accessing the module.
    
    @end table
    @end deftp
    
    
    Furthermore, @code{(gnu services ssh)} provides the following services.
    
    @cindex SSH
    @cindex SSH server
    
    @deffn {Scheme Procedure} lsh-service [#:host-key "/etc/lsh/host-key"] @
    
           [#:daemonic? #t] [#:interfaces '()] [#:port-number 22] @
    
           [#:allow-empty-passwords? #f] [#:root-login? #f] @
           [#:syslog-output? #t] [#:x11-forwarding? #t] @
           [#:tcp/ip-forwarding? #t] [#:password-authentication? #t] @
    
           [#:public-key-authentication? #t] [#:initialize? #t]
    
    Run the @command{lshd} program from @var{lsh} to listen on port @var{port-number}.
    @var{host-key} must designate a file containing the host key, and readable
    only by root.
    
    When @var{daemonic?} is true, @command{lshd} will detach from the
    controlling terminal and log its output to syslogd, unless one sets
    @var{syslog-output?} to false.  Obviously, it also makes lsh-service
    depend on existence of syslogd service.  When @var{pid-file?} is true,
    @command{lshd} writes its PID to the file called @var{pid-file}.
    
    
    When @var{initialize?} is true, automatically create the seed and host key
    upon service activation if they do not exist yet.  This may take long and
    require interaction.
    
    When @var{initialize?} is false, it is up to the user to initialize the
    randomness generator (@pxref{lsh-make-seed,,, lsh, LSH Manual}), and to create
    a key pair with the private key stored in file @var{host-key} (@pxref{lshd
    basics,,, lsh, LSH Manual}).
    
    
    When @var{interfaces} is empty, lshd listens for connections on all the
    network interfaces; otherwise, @var{interfaces} must be a list of host names
    or addresses.
    
    @var{allow-empty-passwords?} specifies whether to accept log-ins with empty
    passwords, and @var{root-login?} specifies whether to accept log-ins as
    
    The other options should be self-descriptive.
    @end deffn
    
    @cindex SSH
    @cindex SSH server
    
    @deffn {Scheme Variable} openssh-service-type
    This is the type for the @uref{http://www.openssh.org, OpenSSH} secure
    shell daemon, @command{sshd}.  Its value must be an
    @code{openssh-configuration} record as in this example:
    
    @example
    (service openssh-service-type
             (openssh-configuration
               (x11-forwarding? #t)
    
               (permit-root-login 'without-password)
               (authorized-keys
                 `(("alice" ,(local-file "alice.pub"))
                   ("bob" ,(local-file "bob.pub"))))))
    
    @end example
    
    See below for details about @code{openssh-configuration}.
    
    
    This service can be extended with extra authorized keys, as in this
    example:
    
    @example
    (service-extension openssh-service-type
                       (const `(("charlie"
                                 ,(local-file "charlie.pub")))))
    @end example
    
    @deftp {Data Type} openssh-configuration
    This is the configuration record for OpenSSH's @command{sshd}.
    
    @table @asis
    @item @code{pid-file} (default: @code{"/var/run/sshd.pid"})
    Name of the file where @command{sshd} writes its PID.
    
    @item @code{port-number} (default: @code{22})
    TCP port on which @command{sshd} listens for incoming connections.
    
    @item @code{permit-root-login} (default: @code{#f})
    This field determines whether and when to allow logins as root.  If
    @code{#f}, root logins are disallowed; if @code{#t}, they are allowed.
    If it's the symbol @code{'without-password}, then root logins are
    permitted but not with password-based authentication.
    
    @item @code{allow-empty-passwords?} (default: @code{#f})
    When true, users with empty passwords may log in.  When false, they may
    not.
    
    @item @code{password-authentication?} (default: @code{#t})
    When true, users may log in with their password.  When false, they have
    other authentication methods.
    
    @item @code{public-key-authentication?} (default: @code{#t})
    When true, users may log in using public key authentication.  When
    false, users have to use other authentication method.
    
    Authorized public keys are stored in @file{~/.ssh/authorized_keys}.
    This is used only by protocol version 2.
    
    @item @code{x11-forwarding?} (default: @code{#f})
    When true, forwarding of X11 graphical client connections is
    enabled---in other words, @command{ssh} options @option{-X} and
    @option{-Y} will work.
    
    
    @item @code{challenge-response-authentication?} (default: @code{#f})
    Specifies whether challenge response authentication is allowed (e.g. via
    PAM).
    
    @item @code{use-pam?} (default: @code{#t})
    Enables the Pluggable Authentication Module interface.  If set to
    @code{#t}, this will enable PAM authentication using
    @code{challenge-response-authentication?} and
    @code{password-authentication?}, in addition to PAM account and session
    module processing for all authentication types.
    
    Because PAM challenge response authentication usually serves an
    equivalent role to password authentication, you should disable either
    @code{challenge-response-authentication?} or
    @code{password-authentication?}.
    
    
    @item @code{print-last-log?} (default: @code{#t})
    Specifies whether @command{sshd} should print the date and time of the
    last user login when a user logs in interactively.
    
    
    @item @code{subsystems} (default: @code{'(("sftp" "internal-sftp"))})
    Configures external subsystems (e.g. file transfer daemon).
    
    This is a list of two-element lists, each of which containing the
    subsystem name and a command (with optional arguments) to execute upon
    subsystem request.
    
    The command @command{internal-sftp} implements an in-process SFTP
    server.  Alternately, one can specify the @command{sftp-server} command:
    @example
    (service openssh-service-type
             (openssh-configuration
              (subsystems
    
               `(("sftp" ,(file-append openssh "/libexec/sftp-server"))))))
    
    @item @code{accepted-environment} (default: @code{'()})
    List of strings describing which environment variables may be exported.
    
    Each string gets on its own line.  See the @code{AcceptEnv} option in
    @code{man sshd_config}.
    
    This example allows ssh-clients to export the @code{COLORTERM} variable.
    It is set by terminal emulators, which support colors.  You can use it in
    your shell's ressource file to enable colors for the prompt and commands
    if this variable is set.
    
    @example
    (service openssh-service-type
             (openssh-configuration
               (accepted-environment '("COLORTERM"))))
    @end example
    
    
    @item @code{authorized-keys} (default: @code{'()})
    @cindex authorized keys, SSH
    @cindex SSH authorized keys
    This is the list of authorized keys.  Each element of the list is a user
    name followed by one or more file-like objects that represent SSH public
    keys.  For example:
    
    @example
    (openssh-configuration
      (authorized-keys
        `(("rekado" ,(local-file "rekado.pub"))
          ("chris" ,(local-file "chris.pub"))
          ("root" ,(local-file "rekado.pub") ,(local-file "chris.pub")))))
    @end example
    
    @noindent
    registers the specified public keys for user accounts @code{rekado},
    @code{chris}, and @code{root}.
    
    
    Additional authorized keys can be specified @i{via}
    @code{service-extension}.
    
    
    Note that this does @emph{not} interfere with the use of
    @file{~/.ssh/authorized_keys}.
    
    @deffn {Scheme Procedure} dropbear-service [@var{config}]
    Run the @uref{https://matt.ucc.asn.au/dropbear/dropbear.html,Dropbear SSH
    daemon} with the given @var{config}, a @code{<dropbear-configuration>}
    object.
    
    For example, to specify a Dropbear service listening on port 1234, add
    this call to the operating system's @code{services} field:
    
    @example
    (dropbear-service (dropbear-configuration
                        (port-number 1234)))
    @end example
    @end deffn
    
    @deftp {Data Type} dropbear-configuration
    This data type represents the configuration of a Dropbear SSH daemon.
    
    @table @asis
    @item @code{dropbear} (default: @var{dropbear})
    The Dropbear package to use.
    
    @item @code{port-number} (default: 22)
    The TCP port where the daemon waits for incoming connections.
    
    @item @code{syslog-output?} (default: @code{#t})
    Whether to enable syslog output.
    
    @item @code{pid-file} (default: @code{"/var/run/dropbear.pid"})
    File name of the daemon's PID file.
    
    @item @code{root-login?} (default: @code{#f})
    Whether to allow @code{root} logins.
    
    @item @code{allow-empty-passwords?} (default: @code{#f})
    Whether to allow empty passwords.
    
    @item @code{password-authentication?} (default: @code{#t})
    Whether to enable password-based authentication.
    @end table
    @end deftp
    
    
    @defvr {Scheme Variable} %facebook-host-aliases
    This variable contains a string for use in @file{/etc/hosts}
    (@pxref{Host Names,,, libc, The GNU C Library Reference Manual}).  Each
    line contains a entry that maps a known server name of the Facebook
    on-line service---e.g., @code{www.facebook.com}---to the local
    host---@code{127.0.0.1} or its IPv6 equivalent, @code{::1}.
    
    This variable is typically used in the @code{hosts-file} field of an
    
    @code{operating-system} declaration (@pxref{operating-system Reference,
    @file{/etc/hosts}}):
    
    
    @example
    (use-modules (gnu) (guix))
    
    (operating-system
      (host-name "mymachine")
      ;; ...
      (hosts-file
        ;; Create a /etc/hosts file with aliases for "localhost"
        ;; and "mymachine", as well as for Facebook servers.
    
        (plain-file "hosts"
                    (string-append (local-host-aliases host-name)
                                   %facebook-host-aliases))))
    
    @end example
    
    This mechanism can prevent programs running locally, such as Web
    browsers, from accessing Facebook.
    @end defvr
    
    
    The @code{(gnu services avahi)} provides the following definition.
    
    
    @deffn {Scheme Procedure} avahi-service [#:avahi @var{avahi}] @
    
              [#:host-name #f] [#:publish? #t] [#:ipv4? #t] @
              [#:ipv6? #t] [#:wide-area? #f] @
    
              [#:domains-to-browse '()] [#:debug? #f]
    
    Return a service that runs @command{avahi-daemon}, a system-wide
    mDNS/DNS-SD responder that allows for service discovery and
    
    "zero-configuration" host name lookups (see @uref{http://avahi.org/}), and
    extends the name service cache daemon (nscd) so that it can resolve
    @code{.local} host names using
    
    @uref{http://0pointer.de/lennart/projects/nss-mdns/, nss-mdns}.  Additionally,
    add the @var{avahi} package to the system profile so that commands such as
    @command{avahi-browse} are directly usable.
    
    
    If @var{host-name} is different from @code{#f}, use that as the host name to
    publish for this machine; otherwise, use the machine's actual host name.
    
    When @var{publish?} is true, publishing of host names and services is allowed;
    in particular, avahi-daemon will publish the machine's host name and IP
    address via mDNS on the local network.
    
    When @var{wide-area?} is true, DNS-SD over unicast DNS is enabled.
    
    Boolean values @var{ipv4?} and @var{ipv6?} determine whether to use IPv4/IPv6
    sockets.
    @end deffn
    
    
    @deffn {Scheme Variable} openvswitch-service-type
    This is the type of the @uref{http://www.openvswitch.org, Open vSwitch}
    service, whose value should be an @code{openvswitch-configuration}
    object.
    @end deffn
    
    @deftp {Data Type} openvswitch-configuration
    Data type representing the configuration of Open vSwitch, a multilayer
    virtual switch which is designed to enable massive network automation
    through programmatic extension.
    
    @table @asis
    @item @code{package} (default: @var{openvswitch})
    Package object of the Open vSwitch.
    
    @end table
    @end deftp
    
    @node X Window
    @subsubsection X Window
    
    @cindex X11
    @cindex X Window System
    
    Support for the X Window graphical display system---specifically
    Xorg---is provided by the @code{(gnu services xorg)} module.  Note that
    there is no @code{xorg-service} procedure.  Instead, the X server is
    
    started by the @dfn{login manager}, by default SLiM.
    
    @cindex window manager
    To use X11, you must install at least one @dfn{window manager}---for
    example the @code{windowmaker} or @code{openbox} packages---preferably
    by adding it to the @code{packages} field of your operating system
    definition (@pxref{operating-system Reference, system-wide packages}).
    
    @defvr {Scheme Variable} slim-service-type
    This is the type for the SLiM graphical login manager for X11.
    
    @cindex session types (X11)
    @cindex X11 session types
    SLiM looks for @dfn{session types} described by the @file{.desktop} files in
    @file{/run/current-system/profile/share/xsessions} and allows users to
    choose a session from the log-in screen using @kbd{F1}.  Packages such
    as @code{xfce}, @code{sawfish}, and @code{ratpoison} provide
    @file{.desktop} files; adding them to the system-wide set of packages
    automatically makes them available at the log-in screen.
    
    In addition, @file{~/.xsession} files are honored.  When available,
    @file{~/.xsession} must be an executable that starts a window manager
    and/or other X clients.
    @end defvr
    
    @deftp {Data Type} slim-configuration
    Data type representing the configuration of @code{slim-service-type}.
    
    @table @asis
    @item @code{allow-empty-passwords?} (default: @code{#t})
    Whether to allow logins with empty passwords.
    
    @item @code{auto-login?} (default: @code{#f})
    @itemx @code{default-user} (default: @code{""})
    When @code{auto-login?} is false, SLiM presents a log-in screen.
    
    When @code{auto-login?} is true, SLiM logs in directly as
    @code{default-user}.
    
    @item @code{theme} (default: @code{%default-slim-theme})
    @itemx @code{theme-name} (default: @code{%default-slim-theme-name})
    The graphical theme to use and its name.
    
    
    @item @code{auto-login-session} (default: @code{#f})
    If true, this must be the name of the executable to start as the default
    session---e.g., @code{(file-append windowmaker "/bin/windowmaker")}.
    
    If false, a session described by one of the available @file{.desktop}
    files in @code{/run/current-system/profile} and @code{~/.guix-profile}
    will be used.
    
    @quotation Note
    You must install at least one window manager in the system profile or in
    your user profile.  Failing to do that, if @code{auto-login-session} is
    false, you will be unable to log in.
    @end quotation
    
    
    @item @code{startx} (default: @code{(xorg-start-command)})
    The command used to start the X11 graphical server.
    
    @item @code{xauth} (default: @code{xauth})
    The XAuth package to use.
    
    @item @code{shepherd} (default: @code{shepherd})
    The Shepherd package used when invoking @command{halt} and
    @command{reboot}.
    
    
    @item @code{sessreg} (default: @code{sessreg})
    The sessreg package used in order to register the session.
    
    
    @item @code{slim} (default: @code{slim})
    The SLiM package to use.
    @end table
    @end deftp
    
    @defvr {Scheme Variable} %default-theme
    @defvrx {Scheme Variable} %default-theme-name
    The default SLiM theme and its name.
    @end defvr
    
    
    
    @deftp {Data Type} sddm-configuration
    This is the data type representing the sddm service configuration.
    
    @table @asis
    @item @code{display-server} (default: "x11")
    Select display server to use for the greeter. Valid values are "x11"
    or "wayland".
    
    @item @code{numlock} (default: "on")
    Valid values are "on", "off" or "none".
    
    @item @code{halt-command} (default @code{#~(string-apppend #$shepherd "/sbin/halt")})
    Command to run when halting.
    
    @item @code{reboot-command} (default @code{#~(string-append #$shepherd "/sbin/reboot")})
    Command to run when rebooting.
    
    @item @code{theme} (default "maldives")
    Theme to use. Default themes provided by SDDM are "elarun" or "maldives".
    
    @item @code{themes-directory} (default "/run/current-system/profile/share/sddm/themes")
    Directory to look for themes.
    
    @item @code{faces-directory} (default "/run/current-system/profile/share/sddm/faces")
    Directory to look for faces.
    
    @item @code{default-path} (default "/run/current-system/profile/bin")
    Default PATH to use.
    
    @item @code{minimum-uid} (default 1000)
    Minimum UID to display in SDDM.
    
    @item @code{maximum-uid} (default 2000)
    Maximum UID to display in SDDM
    
    @item @code{remember-last-user?} (default #t)
    Remember last user.
    
    @item @code{remember-last-session?} (default #t)
    Remember last session.
    
    @item @code{hide-users} (default "")
    Usernames to hide from SDDM greeter.
    
    @item @code{hide-shells} (default @code{#~(string-append #$shadow "/sbin/nologin")})
    Users with shells listed will be hidden from the SDDM greeter.
    
    @item @code{session-command} (default @code{#~(string-append #$sddm "/share/sddm/scripts/wayland-session")})
    Script to run before starting a wayland session.
    
    @item @code{sessions-directory} (default "/run/current-system/profile/share/wayland-sessions")
    Directory to look for desktop files starting wayland sessions.
    
    @item @code{xorg-server-path} (default @code{xorg-start-command})
    Path to xorg-server.
    
    @item @code{xauth-path} (default @code{#~(string-append #$xauth "/bin/xauth")})
    Path to xauth.
    
    @item @code{xephyr-path} (default @code{#~(string-append #$xorg-server "/bin/Xephyr")})
    Path to Xephyr.
    
    @item @code{xdisplay-start} (default @code{#~(string-append #$sddm "/share/sddm/scripts/Xsetup")})
    Script to run after starting xorg-server.
    
    @item @code{xdisplay-stop} (default @code{#~(string-append #$sddm "/share/sddm/scripts/Xstop")})
    Script to run before stopping xorg-server.
    
    
    Tobias Geerinckx-Rice's avatar
    Tobias Geerinckx-Rice committed
    @item @code{xsession-command} (default: @code{xinitrc})
    
    Script to run before starting a X session.
    
    @item @code{xsessions-directory} (default: "/run/current-system/profile/share/xsessions")
    Directory to look for desktop files starting X sessions.
    
    @item @code{minimum-vt} (default: 7)
    Minimum VT to use.
    
    @item @code{xserver-arguments} (default "-nolisten tcp")
    Arguments to pass to xorg-server.
    
    @item @code{auto-login-user} (default "")
    User to use for auto-login.
    
    @item @code{auto-login-session} (default "")
    Desktop file to use for auto-login.
    
    @item @code{relogin?} (default #f)
    Relogin after logout.
    
    @end table
    @end deftp
    
    
    @cindex login manager
    
    @deffn {Scheme Procedure} sddm-service config
    Return a service that spawns the SDDM graphical login manager for config of
    type @code{<sddm-configuration>}.
    
    @example
      (sddm-service (sddm-configuration
                     (auto-login-user "Alice")
                     (auto-login-session "xfce.desktop")))
    @end example
    @end deffn
    
    
    @deffn {Scheme Procedure} xorg-start-command [#:guile] @
    
      [#:modules %default-xorg-modules] @
      [#:fonts %default-xorg-fonts] @
      [#:configuration-file (xorg-configuration-file @dots{})] @
      [#:xorg-server @var{xorg-server}]
    Return a @code{startx} script in which @var{modules}, a list of X module
    packages, and @var{fonts}, a list of X font directories, are available.  See
    @code{xorg-wrapper} for more details on the arguments.  The result should be
    used in place of @code{startx}.
    
    
    Usually the X server is started by a login manager.
    @end deffn
    
    
    @deffn {Scheme Procedure} xorg-configuration-file @
    
      [#:modules %default-xorg-modules] @
      [#:fonts %default-xorg-fonts] @
    
      [#:drivers '()] [#:resolutions '()] [#:extra-config '()]
    
    Return a configuration file for the Xorg server containing search paths for
    all the common drivers.
    
    @var{modules} must be a list of @dfn{module packages} loaded by the Xorg
    server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so on.
    @var{fonts} must be a list of font directories to add to the server's
    @dfn{font path}.
    
    
    @var{drivers} must be either the empty list, in which case Xorg chooses a
    graphics driver automatically, or a list of driver names that will be tried in
    
    this order---e.g., @code{("modesetting" "vesa")}.
    
    
    Likewise, when @var{resolutions} is the empty list, Xorg chooses an
    appropriate screen resolution; otherwise, it must be a list of
    resolutions---e.g., @code{((1024 768) (640 480))}.
    
    
    Last, @var{extra-config} is a list of strings or objects appended to the
    
    configuration file.  It is used to pass extra text to be
    added verbatim to the configuration file.
    
    
    @cindex keymap
    @cindex keyboard layout
    This procedure is especially useful to configure a different keyboard layout
    than the default US keymap.  For instance, to use the ``bépo'' keymap by
    default on the display manager:
    
    @example
    (define bepo-evdev
      "Section \"InputClass\"
            Identifier \"evdev keyboard catchall\"
            Driver \"evdev\"
            MatchIsKeyboard \"on\"
            Option \"xkb_layout\" \"fr\"
            Option \"xkb_variant\" \"bepo\"
    EndSection")
    
    (operating-system
      ...
      (services
        (modify-services %desktop-services
          (slim-service-type config =>
            (slim-configuration
              (inherit config)
              (startx (xorg-start-command
                       #:configuration-file
                       (xorg-configuration-file
                         #:extra-config
                         (list bepo-evdev)))))))))
    @end example
    
    The @code{MatchIsKeyboard} line specifies that we only apply the configuration
    to keyboards.  Without this line, other devices such as touchpad may not work
    correctly because they will be attached to the wrong driver.  In this example,
    the user typically used @code{setxkbmap fr bepo} to set their favorite keymap
    once logged in.  The first argument corresponds to the layout, while the second
    argument corresponds to the variant.  The @code{xkb_variant} line can be omitted
    to select the default variant.
    
    @deffn {Scheme Procedure} screen-locker-service @var{package} [@var{program}]
    
    Add @var{package}, a package for a screen locker or screen saver whose
    
    command is @var{program}, to the set of setuid programs and add a PAM entry
    for it.  For example:
    
    @lisp
    (screen-locker-service xlockmore "xlock")
    @end lisp
    
    makes the good ol' XlockMore usable.
    @end deffn
    
    
    
    Andy Wingo's avatar
    Andy Wingo committed
    @node Printing Services
    @subsubsection Printing Services
    
    
    @cindex printer support with CUPS
    
    Andy Wingo's avatar
    Andy Wingo committed
    The @code{(gnu services cups)} module provides a Guix service definition
    for the CUPS printing service.  To add printer support to a GuixSD
    system, add a @code{cups-service} to the operating system definition:
    
    @deffn {Scheme Variable} cups-service-type
    The service type for the CUPS print server.  Its value should be a valid
    
    CUPS configuration (see below).  To use the default settings, simply
    write:
    
    Andy Wingo's avatar
    Andy Wingo committed
    @example
    
    Andy Wingo's avatar
    Andy Wingo committed
    @end example
    @end deffn
    
    The CUPS configuration controls the basic things about your CUPS
    installation: what interfaces it listens on, what to do if a print job