add sample configuration schema

This commit is contained in:
Kiara Grouwstra 2025-06-02 15:44:53 +02:00
parent 341c96ce06
commit 6e385a527d
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU

View file

@ -220,6 +220,160 @@ Whereas the core abstraction in Fediversity is a NixOS configuration module, a m
![](https://git.fediversity.eu/Fediversity/meta/raw/branch/main/architecture-docs/host-architecture.png)
### Sample configuration schema
Whereas Nix(OS) option modules use Nix to specify types, in order to communicate the expected schema to other tools such as web applications, we use [JSON Schema](https://json-schema.org/) as an intermediate format, building upon [earlier work converting between such schemas by Nix collective Clan](https://clan.lol/blog/json-schema-converter/).
An example of such a schema might looks as follows:
```json
{
"$exportedModuleInfo": {
"path": []
},
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"domain": {
"$exportedModuleInfo": {
"path": [
"domain"
]
},
"default": "fediversity.net",
"description": "Apex domain under which the services will be deployed.\n",
"enum": [
"fediversity.net"
]
},
"enable": {
"$exportedModuleInfo": {
"path": [
"enable"
]
},
"default": false,
"description": "Whether to enable Fediversity configuration.",
"examples": [
true
],
"type": "boolean"
},
"initialUser": {
"$exportedModuleInfo": {
"path": [
"initialUser"
]
},
"default": null,
"description": "Some services require an initial user to access them.\nThis option sets the credentials for such an initial user.\n",
"oneOf": [
{
"type": "null"
},
{
"$exportedModuleInfo": {
"path": [
"initialUser"
]
},
"additionalProperties": false,
"properties": {
"displayName": {
"$exportedModuleInfo": {
"path": [
"initialUser",
"displayName"
]
},
"description": "Display name of the user",
"type": "string"
},
"email": {
"$exportedModuleInfo": {
"path": [
"initialUser",
"email"
]
},
"description": "User's email address",
"type": "string"
},
"password": {
"$exportedModuleInfo": {
"path": [
"initialUser",
"password"
]
},
"description": "Password for login",
"type": "string"
},
"username": {
"$exportedModuleInfo": {
"path": [
"initialUser",
"username"
]
},
"description": "Username for login",
"type": "string"
}
},
"required": [
"displayName",
"email",
"password",
"username"
],
"type": "object"
}
]
},
"forgejo": {
"$exportedModuleInfo": {
"path": [
"forgejo"
]
},
"default": null,
"description": "Configuration for the Forgejo service\n",
"oneOf": [
{
"type": "null"
},
{
"$exportedModuleInfo": {
"path": [
"forgejo"
]
},
"additionalProperties": false,
"properties": {
"enable": {
"$exportedModuleInfo": {
"path": [
"forgejo",
"enable"
]
},
"default": false,
"description": "Whether to enable Forgejo.",
"examples": [
true
],
"type": "boolean"
}
},
"type": "object"
}
]
}
},
"type": "object"
}
```
## Break-down of project milestones
Whereas details of the implementation may need to be decided as the technical challenges involved become clear, we can already give a higher-level planning of relevant milestones and some of their salient features: