Concept

Changing what a feature does

The short version

Use modify-features to change or remove feature instances in a list. Use an override to replace or remove one item a feature sends to a receiver. Both name the thing they change and fail when it no longer exists, so an update can't silently leave an old customization doing nothing.

Change the instance's configuration

The modify-features form patches every matching instance of a type. Use named to select one instance by name. The optional name: field changes its name; selection and renaming are separate operations. A drop clause removes matching instances. Every clause must match; it isn't an instruction to add a missing feature.

Inside modify-features, the clause (X field: v) patches an existing instance. The same call in a feature list builds a fresh instance with defaults.

This example changes the server list's SSH port. The patched instance keeps every other field, and the firewall rule the SSH feature sends follows the new port: nftables opens 2222 instead of 22. The manual composes this configuration on every build and checks that.

Example: overrides-port

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

(system-configuration
  features:
    (modify-features %server-features
      (ssh-server-feature port: 2222)))

Verified

The example shows only the part of the configuration it changes. A real system.sgl also sets the host name, kernel, disks and accounts.

Use replace when the fields you leave out should return to their defaults. It keeps the instance's list position and its name unless the replacement gives name: explicitly. This configuration patches SSH, replaces the login prompt and removes cron:

Example: overrides-clauses

(import (vessel system)
        (vessel system features ssh)
        (vessel system features getty)
        (vessel system features cron))

(system-configuration
  features:
    (modify-features %server-features
      (ssh-server-feature port: 2222)
      (replace (getty-feature tty: "tty1"))
      (drop cron-feature)))

Verified

A named selection uses (named "internal" port: 2222) to patch that instance. A drop clause may also name one instance with a string, as in the clause (drop "internal"). Both forms refuse a name that is absent.

Change a field using its old value

A plain field value replaces the old value. Use merge to append to a list or set named keys in a dictionary or record, keeping the other keys. This adds another allowed source without replacing the existing sources:

Example: overrides-merge

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

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

(ssh-server-feature office-ssh
  sources: (merge '("198.51.100.0/24")))

Verified

Use update with a procedure that receives the old field value and returns the new value. It works in a copy, a fresh call using defaults, or a patch clause:

Example: overrides-update

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

(modify-features %server-features
  (ssh-server-feature port: (update (lambda (old) (+ old 1)))))

Verified

An explicit (replace value) also replaces a field. A plain procedure is a field value; it runs only when wrapped in update. Each result must satisfy the field's type. A feature can declare its own merge rule; merging an unsupported field fails with the feature and field names.

Change one contribution

An override names the extension's target type, an item claim and the sending instance, with a reason. It can name the item kind when a claim matches several kinds, and the receiving instance when several receive that type. It must select exactly one item. The target is the contract the sender used, such as firewall, even when nftables receives it.

A replacement must keep the original claims. For a firewall rule this lets you narrow the source addresses while keeping the same protocol and ports. Moving SSH to another port belongs in the SSH configuration, because that also changes the daemon, listener claim and health check. An override's replacement value of #f removes the contribution instead.

This override narrows the default SSH rule to one example network. It names the firewall contract, the SSH instance and the existing port claim. With it, nftables accepts SSH only from 192.0.2.0/24, which the manual checks on every build.

Example: overrides-rule

(import (vessel system))

(system-configuration
  features: %server-features
  overrides:
    (list
      (override
        extension-type: firewall-feature
        key: "tcp/22"
        from: "ssh-server"
        with: (firewall-rule
                ports: '(22)
                sources: '("192.0.2.0/24"))
        reason: "SSH only from the management network")))

Verified

The selection, replacement and reason remain in the composition's override record. A stale selection or a replacement that changes claims is an error. Overrides have no priorities, and their scope is one received item; they don't replace the feature's whole result or change unrelated contributions.

In practice

See the ssh-server feature for the port and source options and the feature index for receiving contracts. The system.sgl the installer writes has a feature list and an overrides list, so you can use modify-features and overrides in it. On 2026.1, though, a rebuild can use only the packages already on the computer. The examples on this page need Dropbear, nftables and cron, which an installed 2026.1 system doesn't have, so they compose but don't build there.

Created with Sigil