Previous: , Up: Defining Services   [Contents][Index] Shepherd Services

The (gnu services shepherd) module provides a way to define services managed by the GNU Shepherd, which is the GuixSD initialization system—the first process that is started when the system boots, also known as PID 1 (see Introduction in The GNU Shepherd Manual).

Services in the Shepherd can depend on each other. For instance, the SSH daemon may need to be started after the syslog daemon has been started, which in turn can only happen once all the file systems have been mounted. The simple operating system defined earlier (see Using the Configuration System) results in a service graph like this:

Typical shepherd service graph.

You can actually generate such a graph for any operating system definition using the guix system shepherd-graph command (see guix system shepherd-graph).

The %shepherd-root-service is a service object representing PID 1, of type shepherd-root-service-type; it can be extended by passing it lists of <shepherd-service> objects.

Data Type: shepherd-service

The data type representing a service managed by the Shepherd.


This is a list of symbols denoting what the service provides.

These are the names that may be passed to herd start, herd status, and similar commands (see Invoking herd in The GNU Shepherd Manual). See the provides slot in The GNU Shepherd Manual, for details.

requirements (default: '())

List of symbols denoting the Shepherd services this one depends on.

respawn? (default: #t)

Whether to restart the service when it stops, for instance when the underlying process dies.

stop (default: #~(const #f))

The start and stop fields refer to the Shepherd’s facilities to start and stop processes (see Service De- and Constructors in The GNU Shepherd Manual). They are given as G-expressions that get expanded in the Shepherd configuration file (see G-Expressions).


A documentation string, as shown when running:

herd doc service-name

where service-name is one of the symbols in provision (see Invoking herd in The GNU Shepherd Manual).

modules (default: %default-modules)

This is the list of modules that must be in scope when start and stop are evaluated.

Scheme Variable: shepherd-root-service-type

The service type for the Shepherd “root service”—i.e., PID 1.

This is the service type that extensions target when they want to create shepherd services (see Service Types and Services, for an example). Each extension must pass a list of <shepherd-service>.

Scheme Variable: %shepherd-root-service

This service represents PID 1.

Previous: , Up: Defining Services   [Contents][Index]