3 Group configuration

Groups are defined inside the (group) configuration file, which is located at config_dir/groups.kdl (see config-dir). This file is formatted as a KDL configuration file, you can find the official specification on KDL website. Each group is declared by using a def-group node:


def-group Group1 {
    sd {
        (section)Unit {
            (add) After "dbus.service" \
                "pipewire.service"
            (add) Requisite "dbus.service" \
                "pipewire.service"
            (reset) JoinsNamespaceOf
            (set) Description "Group1"
        }
    }
}
def-group Group2 {
    sd {
        (section) Unit {
            (set) Documentation "man:group(2)"
        }
        (section) Service {
            (set) Type "exec"
        }
    }
}

Any valid KDL string can be used as group name, in particular you can embed whitespaces if you surround the whole name of the group between double quotes ‘"’.

Each group may contain zero or more sd nodes containing rules for Systemd fields. Each sd node contains nodes with type section (enclosed in parenthesis) representing systemd sections (e.g. Unit, Service, Slice). Within each section, the following operations are supported as node types:

set

assigns one or more values to a field;

reset

clears the field;

add

adds one or more values to the field.

The names of the nodes with type section, set, reset, add is the section/field name represented by such node. As remarked in the previous list, nodes with type set or add must have one or more KDL arguments represented as:

Tomloader will automatically convert these objects as strings in the canonical way, in particular both the KDL boolean #true and the KDL quoted string "true" are seen by Tomloader as the string true.

Field values are internally represented as a list of strings. Just before generating the systemd unit file each list of strings is merged into a single:

Note: The order of values specified in set and add is not preserved, therefore in the generated unit they may appear in a different order (which will still be deterministic). If the order of those elements must be preserved, then a single set operation with a single string containing the ordered values is sufficient (Tomloader never adds double quotes ‘"’ to string values unless they are already present inside the value).