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
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
It doesn't matter where the machine gets introduced to buildClan - All delarations are valid, duplications are merged.
@@ -47,13 +49,8 @@ buildClan {
inventory = {
machines = {
"backup_server" = {
# Don't include any nixos config here
# The following fields are avilable
# description: null | string
# icon: null | string
# name: string
# system: null | string
# tags: [...string]
# Don't include any nixos config here.
# See the Inventory API Docs for the available attributes.
};
"jon" = {
# 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.
!!! 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
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
The inventory allows machines to set **Tags**
### Scaling the Backup
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 = [ ];
type = types.listOf (
types.oneOf [