Concept

Features: how a configuration composes

The short version

A feature is one part of a configuration, such as an SSH server or a login prompt. Its type declares which other types receive its contributions. Composition follows those edges, collecting packages, files, accounts and service records into one system. A feature can run several services, or none.

Calling and reusing a feature

Call a feature type with keyword fields to make an instance, such as the call (ssh-server-feature port: 2222). An empty call uses its defaults. Use name: to give a second instance its own name. Feature lists contain instances, so each type must be called.

Ordinary procedures make reusable configurations. Calling a type with an existing instance copies it with changed fields, keeping its name and the fields you leave out. A copy of another type's instance is refused. Unknown fields, invalid values and missing required fields are errors that name the feature and field. Configuration records stay internal.

Example: features-copy

(import (vessel system)
        (vessel system features ssh))

(define (office-ssh port)
  (ssh-server-feature name: "internal" port: port
    sources: '("192.0.2.0/24")))

(define base-ssh (office-ssh 2222))
(ssh-server-feature base-ssh open-firewall: #f)

Verified

Types, instances and receivers

A feature type is a reusable definition. A feature instance pairs that type with a configuration value and a name. The name defaults to the type's name; several instances need distinct names, and the type must also keep their contributed service names, files and other claims distinct.

Each extension computes items from its own instance and the items it has received. Values travel only along declared edges; a feature can't read a global final configuration. The engine rejects cycles. A missing receiver is an error unless the edge is optional, in which case the drop is recorded. It never inserts a default receiver to make an edge work.

Every system gets receivers for packages, accounts, files, filesystems, state directories, secrets, health checks and listening ports. The reserved instance system sends the configuration's own fields to those receivers. Service management, firewall policy and scheduled jobs use abstract types: you choose a concrete implementation to receive them. For example, dinit implements services, while nftables implements firewall. An abstract type has no instances of its own.

A feature becomes services

Here a base system has a login prompt and dinit. Composing it gives one service, getty-service, without starting a process, building a package or touching a disk. The manual composes this configuration on every build and checks that.

Example: features-compose

(import (vessel system)
        (vessel packages linux))

(system-configuration
  host-name: "harbor"
  kernel: linux
  bootloader: (efi-bootloader partition: "/dev/vda1")
  file-systems: (list (file-system device: "/dev/vda2" mount-point: "/"))
  users: (list (user-account name: "root" uid: 0 gid: 0 home: "/root"))
  packages: %base-packages
  features: %base-features)

Verified

The health service is added later by the system builder, so it isn't among the composed services. The base features don't include networking. The server list adds SSH, nftables and cron; it still needs a network feature before the SSH service's network dependency can be satisfied.

Claims make conflicts visible

Receivers declare item kinds and the keys an item claims: a file claims its path; an account claims its name and UID. Equal items merge and retain their senders. Different items of the same kind that share a claim fail composition, with the contributors named. There is no last writer that silently wins.

When several instances receive one type, a sender uses to-instance to pick an instance by name. The with-note wrapper records why an item was sent. The composition retains these origins for the library's explain functions; a public vessel system explain command is still planned.

In practice

The feature index lists every type and its connections. Read Overrides and modify-features when an existing feature needs a change, and Services and the service manager for what happens to its process definitions. The installer writes an editable feature list, but on 2026.1 a rebuild can use only the packages already on the computer.

Created with Sigil