selfhostblocks/modules/contracts/dashboard/docs/default.md
2026-02-24 20:00:36 +01:00

1.8 KiB

Dashboard Contract

This NixOS contract is used for user-facing services that want to be displayed on a dashboard.

It is a contract between a service that can be accessed through an URL and a service that wants to show a list of those services.

Providers

The providers of this contract in SHB are:

Usage

A service that can be shown on a dashboard will provide a dashboard option.

Here is an example module defining such a requester option for this dashboard contract:

{
  options = {
    myservice.dashboard = lib.mkOption {
      description = ''
        Dashboard contract consumer
      '';
      default = { };
      type = lib.types.submodule {
        options = shb.contracts.dashboard.mkRequester {
          externalUrl = "https://${config.myservice.subdomain}.${config.myservice.domain}";
          internalUrl = "http://127.0.0.1:${config.myservice.port}";
        };
      };
    };
  };
};

Then, plug both consumer and provider together in the config:

{
  config = {
    <provider-module> = {
      dashboard.request = config.myservice.dashboard.request;
    };
  };
}

And that's it for the contract part. For more specific details on each provider, go to their respective manual pages.

Contract Reference

These are all the options that are expected to exist for this contract to be respected.

id-prefix: contracts-dashboard-options-
list-id: selfhostblocks-options
source: @OPTIONS_JSON@