forked from Fediversity/Fediversity
50 lines
1.5 KiB
Nix
50 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
panelConfigNullable,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) types mkOption;
|
|
|
|
## The convertor from module options to JSON schema does not generate proper
|
|
## JSON schema types, forcing us to use nullable fields for default values.
|
|
## However, working with those fields in the deployment code is annoying (and
|
|
## unusual for Nix programmers), so we sanitize the input here and add back
|
|
## the default value by hand.
|
|
nonNull = x: v: if x == null then v else x;
|
|
panelConfig = {
|
|
domain = nonNull panelConfigNullable.domain "fediversity.net";
|
|
initialUser = nonNull panelConfigNullable.initialUser {
|
|
displayName = "Testy McTestface";
|
|
username = "test";
|
|
password = "testtest";
|
|
email = "test@test.com";
|
|
};
|
|
mastodon = nonNull panelConfigNullable.mastodon { enable = false; };
|
|
peertube = nonNull panelConfigNullable.peertube { enable = false; };
|
|
pixelfed = nonNull panelConfigNullable.pixelfed { enable = false; };
|
|
};
|
|
in
|
|
{
|
|
options = {
|
|
deployment = types.submodule {
|
|
module = mkOption {
|
|
description = ''
|
|
Configuration to be deployed
|
|
'';
|
|
# XXX(@fricklerhandwerk):
|
|
# misusing this will produce obscure errors that will be truncated by NixOps4
|
|
type = lib.types.submodule ./options.nix;
|
|
default = panelConfig;
|
|
};
|
|
state = mkOption {
|
|
description = ''
|
|
State of the deployment
|
|
'';
|
|
# TODO: TF state
|
|
type = types.deferredModule;
|
|
default = { };
|
|
};
|
|
};
|
|
};
|
|
}
|