forked from fediversity/fediversity
87 lines
2.5 KiB
Nix
87 lines
2.5 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) mkOption;
|
|
inherit (lib.types)
|
|
attrsOf
|
|
attrTag
|
|
deferredModule
|
|
mergeTypes
|
|
nullOr
|
|
submoduleWith
|
|
submodule
|
|
str
|
|
;
|
|
in
|
|
{
|
|
options = {
|
|
resources = mkOption {
|
|
description = "Collection of deployment resources that can be configured by hosting providers and required by applications";
|
|
type = attrsOf (
|
|
submodule (
|
|
{ config, ... }:
|
|
{
|
|
options = {
|
|
consumer = mkOption {
|
|
description = "Configuration of the resource by an application, a description of how the resource is consumed";
|
|
type = deferredModule;
|
|
};
|
|
provider = mkOption {
|
|
description = "Configuration of the resource by the hosting provider, a description of how the resource is made available";
|
|
type = deferredModule;
|
|
};
|
|
};
|
|
}
|
|
)
|
|
);
|
|
};
|
|
applications = mkOption {
|
|
description = "Collection of Fediversity applications";
|
|
type = attrsOf (
|
|
submodule (
|
|
{ config, ... }:
|
|
{
|
|
options = {
|
|
module = mkOption {
|
|
description = "Operator-facing configuration options for the application";
|
|
type = deferredModule;
|
|
};
|
|
config-mapping = mkOption {
|
|
description = "Mapping of application configuration to deployment resources, a description of what an application needs to run";
|
|
# TODO: type = (submodule config.module) -> (attrsOf resource)
|
|
};
|
|
};
|
|
}
|
|
)
|
|
);
|
|
};
|
|
environments = mkOption {
|
|
description = "Run-time environments for Fediversity applications to be deployed to";
|
|
type = attrsOf (
|
|
submodule (
|
|
{ config, ... }:
|
|
{
|
|
options = {
|
|
required-resources = mkOption {
|
|
description = "Resources required by configured applications";
|
|
# TODO: type = ?
|
|
|
|
};
|
|
available-resources = mkOption {
|
|
description = "Resources made available by the hosting provider";
|
|
# TODO: type = ?
|
|
};
|
|
resource-mapping = mkOption {
|
|
description = "Mapping of resources required by applications to available resources";
|
|
# TODO: type = ?
|
|
};
|
|
};
|
|
}
|
|
)
|
|
);
|
|
};
|
|
};
|
|
}
|