From 7a4eeb5b164750f2e45b0a49b858b8c53c83cdb4 Mon Sep 17 00:00:00 2001 From: DavHau Date: Mon, 30 Jun 2025 17:13:28 +0700 Subject: [PATCH] docs: explain about simplified way of specifying instances --- docs/site/guides/clanServices.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/site/guides/clanServices.md b/docs/site/guides/clanServices.md index c34a5191a..a1ed6f82b 100644 --- a/docs/site/guides/clanServices.md +++ b/docs/site/guides/clanServices.md @@ -29,7 +29,7 @@ Example of instantiating a `borgbackup` service using `clan-core`: ```nix inventory.instances = { - # Arbitrary unique name for this 'borgbackup' instance + # Instance Name: Arbitrary unique name for this 'borgbackup' instance borgbackup-example = { module = { name = "borgbackup"; # <-- Name of the module @@ -50,6 +50,23 @@ If you used `clan-core` as an input attribute for your flake: inputs.clan-core.url = "git+https://git.clan.lol/clan/clan-core" ``` +## Simplified Example + +If only one instance is needed for a service and the service is a clan core service, the `module` definition can be omitted. + +```nix +# Simplified way of specifying a single instance +inventory.instances = { + # instance name is `borgbackup` -> clan core module `borgbackup` will be loaded. + borgbackup = { + # Participation of the machines is defined via roles + # Right side needs to be an attribute set. Its purpose will become clear later + roles.client.machines."machine-a" = {}; + roles.server.machines."backup-host" = {}; + }; +} +``` + ## Configuration Example Each role might expose configurable options