Merge pull request 'Inventory: improve usability from nix' (#2116) from hsjobeki/clan-core:hsjobeki-main into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/2116
This commit is contained in:
hsjobeki
2024-09-16 13:50:03 +00:00
2 changed files with 11 additions and 11 deletions

View File

@@ -25,7 +25,9 @@ buildClan {
## How to add machines ## How to add machines
Machines can be added via `inventory.machines` OR via `buildClan` directly. Every machine of the form `machines/{machineName}/configuration.nix` will be registered automatically.
Machines can also be manually added under `inventory.machines` OR via `buildClan` directly.
!!! Note !!! Note
It doesn't matter where the machine gets introduced to buildClan - All delarations are valid, duplications are merged. It doesn't matter where the machine gets introduced to buildClan - All delarations are valid, duplications are merged.
@@ -47,13 +49,8 @@ buildClan {
inventory = { inventory = {
machines = { machines = {
"backup_server" = { "backup_server" = {
# Don't include any nixos config here # Don't include any nixos config here.
# The following fields are avilable # See the Inventory API Docs for the available attributes.
# description: null | string
# icon: null | string
# name: string
# system: null | string
# tags: [...string]
}; };
"jon" = { "jon" = {
# Same as above # Same as above
@@ -75,6 +72,10 @@ Currently the inventory interface is implemented by the following clanModules
See the respective module documentation for available roles. See the respective module documentation for available roles.
!!! Note
It is possible to use any [clanModule](../reference/clanModules/index.md) in the inventory and add machines via
`roles.default.*`
### Adding services to machines ### Adding services to machines
A module can be added to one or multiple machines via `Roles`. clan's `Role` interface provide sane defaults for a module this allows the module author to reduce the configuration overhead to a minimum. A module can be added to one or multiple machines via `Roles`. clan's `Role` interface provide sane defaults for a module this allows the module author to reduce the configuration overhead to a minimum.
@@ -117,9 +118,7 @@ Each service can still be customized and configured according to the modules opt
} }
``` ```
### Scalabling the Backup ### Scaling the Backup
The inventory allows machines to set **Tags**
It is possible to add services to multiple machines via tags. The service instance gets added in the specified role. In this case `role = "client"` It is possible to add services to multiple machines via tags. The service instance gets added in the specified role. In this case `role = "client"`

View File

@@ -62,6 +62,7 @@ let
``` ```
''; '';
apply = value: if lib.isString value then value else builtins.seq (builtins.toJSON value) value;
default = [ ]; default = [ ];
type = types.listOf ( type = types.listOf (
types.oneOf [ types.oneOf [