Dashboard Contract

Table of Contents

Providers
Usage
Contract Reference

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.

shb.contracts.dashboard

Contract for user-facing services that want to be displayed on a dashboard.

The requester communicates to the provider how to access the service through the request options.

The provider reads from the request options and configures what is necessary on its side to show the service and check its availability. It does not communicate back to the requester.

Type: submodule

Declared by:

<selfhostblocks/modules/contracts/dashboard/dummyModule.nix>
shb.contracts.dashboard.request

Request part of the dashboard contract.

Type: submodule

Default:

{ }

Declared by:

<selfhostblocks/modules/contracts/dashboard/dummyModule.nix>
shb.contracts.dashboard.request.externalUrl

URL at which the service can be accessed.

This URL should go through the reverse proxy.

Type: string

Default:

""

Example:

"https://jellyfin.example.com"

Declared by:

<selfhostblocks/modules/contracts/dashboard/dummyModule.nix>
shb.contracts.dashboard.request.internalUrl

URL at which the service can be accessed directly.

This URL should bypass the reverse proxy. It can be used for example to ping the service and making sure it is up and running correctly.

Type: null or string

Default:

null

Example:

"http://127.0.0.1:8081"

Declared by:

<selfhostblocks/modules/contracts/dashboard/dummyModule.nix>
shb.contracts.dashboard.result

Result part of the dashboard contract.

No option is provided here.

Type: submodule

Default:

{ }

Declared by:

<selfhostblocks/modules/contracts/dashboard/dummyModule.nix>
shb.contracts.dashboard.settings

Optional attribute set with options specific to the provider.

Type: anything

Declared by:

<selfhostblocks/modules/contracts/dashboard/dummyModule.nix>