Fediversity/deployment/options.nix
Kiara Grouwstra da16381a9b
panel deploys thru model
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-11-23 16:08:51 +01:00

110 lines
3 KiB
Nix

/**
Deployment options as to be presented in the front end.
These are converted to JSON schema in order to generate front-end forms etc.
For this to work, options must not have types `functionTo` or `package`, and must not access `config` for their default values.
The options are written in a cumbersome way because the JSON schema converter can't evaluate a submodule option's default value, which thus all must be set to `null`.
This can be fixed if we made the converter aware of [`$defs`], but that would likely amount to half a rewrite.
[`$defs`]: https://json-schema.org/understanding-json-schema/structuring#defs
*/
{
lib,
...
}:
let
inherit (lib) types mkOption mkEnableOption;
inherit (types)
enum
nullOr
submodule
str
;
in
{
_class = "nixops4Deployment";
options = {
enable = mkEnableOption "Fediversity configuration";
domain = mkOption {
type = enum [
"fediversity.net"
];
description = ''
Apex domain under which the services will be deployed.
'';
default = "fediversity.net";
};
applications = mkOption {
description = ''
Applications to deploy.
'';
type = nullOr (submodule {
options = {
pixelfed = mkOption {
description = ''
Configuration for the Pixelfed service
'';
type = nullOr (submodule {
options = {
enable = mkEnableOption "Pixelfed";
};
});
default = null;
};
peertube = mkOption {
description = ''
Configuration for the PeerTube service
'';
type = nullOr (submodule {
options = {
enable = mkEnableOption "Peertube";
};
});
default = null;
};
mastodon = mkOption {
description = ''
Configuration for the Mastodon service
'';
type = nullOr (submodule {
options = {
enable = mkEnableOption "Mastodon";
};
});
default = null;
};
};
});
default = null;
};
initialUser = mkOption {
description = ''
Some services require an initial user to access them.
This option sets the credentials for such an initial user.
'';
type = nullOr (submodule {
options = {
displayName = mkOption {
type = str;
description = "Display name of the user";
};
username = mkOption {
type = str;
description = "Username for login";
};
email = mkOption {
type = str;
description = "User's email address";
};
password = mkOption {
type = str;
description = "Password for login";
};
};
});
default = null;
};
};
}