forked from fediversity/fediversity
WIP
This commit is contained in:
parent
1d7a18b0a6
commit
7225eda440
1 changed files with 56 additions and 97 deletions
|
@ -4,12 +4,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkOption;
|
||||||
attrNames
|
|
||||||
mapAttrs
|
|
||||||
mkOption
|
|
||||||
genAttrs
|
|
||||||
;
|
|
||||||
inherit (lib.types)
|
inherit (lib.types)
|
||||||
attrsOf
|
attrsOf
|
||||||
attrTag
|
attrTag
|
||||||
|
@ -20,104 +15,68 @@ let
|
||||||
submodule
|
submodule
|
||||||
str
|
str
|
||||||
;
|
;
|
||||||
resource = submoduleWith {
|
in
|
||||||
description = "A deployment resource that can be configured by providers and required by applications";
|
|
||||||
modules = [
|
|
||||||
{
|
{
|
||||||
|
options = {
|
||||||
|
resources = mkOption {
|
||||||
|
description = "Collection of deployment resources that can be configured by hosting providers and required by applications";
|
||||||
|
type = attrsOf (submodule {
|
||||||
options = {
|
options = {
|
||||||
consumer = mkOption {
|
consumer = mkOption {
|
||||||
description = "Description how applications can consume the resource";
|
description = "Configuration of the resource by an application, a description of how the resource is consumed";
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
};
|
};
|
||||||
provider = mkOption {
|
provider = mkOption {
|
||||||
description = "Description how the hosting provider makes the resource available";
|
description = "Configuration of the resource by the hosting provider, a description of how the resource is made available";
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
];
|
|
||||||
};
|
};
|
||||||
application = submoduleWith {
|
applications = mkOption {
|
||||||
description = "A Fediversity application";
|
description = "Collection of Fediversity applications";
|
||||||
modules = [
|
type = attrsOf (
|
||||||
(
|
submodule (
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
module = mkOption {
|
module = mkOption {
|
||||||
description = ''
|
description = "Operator-facing configuration options for the application";
|
||||||
A module for configuring the application.
|
|
||||||
'';
|
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
};
|
};
|
||||||
config-mapping = mkOption {
|
config-mapping = mkOption {
|
||||||
description = "description of how an application configuration maps to deployment resources";
|
description = "Mapping of application configuration to deployment resources, a description of what an application needs to run";
|
||||||
# TODO: type = (submodule config.module) -> (attrsOf resource)
|
# TODO: type = (submodule config.module) -> (attrsOf resource)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
);
|
||||||
};
|
};
|
||||||
deployment = submoduleWith {
|
environments = mkOption {
|
||||||
description = "A deployment of a configuration of applications to a run-time environment";
|
description = "Run-time environments for Fediversity applications to be deployed to";
|
||||||
modules = [
|
type = attrsOf (
|
||||||
|
submodule (
|
||||||
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
# the `applications` option consists of configuration for the above applications
|
required-resources = mkOption {
|
||||||
module = mkOption {
|
description = "Resources required by configured applications";
|
||||||
description = ''
|
# TODO: type = ?
|
||||||
Configuration to be deployed
|
|
||||||
'';
|
|
||||||
type = deferredModule;
|
|
||||||
};
|
};
|
||||||
runtime-environment = mkOption {
|
available-resources = mkOption {
|
||||||
description = "The run-time environment to deploy to";
|
description = "Resources made available by the hosting provider";
|
||||||
type = runtime-environment;
|
# TODO: type = ?
|
||||||
|
};
|
||||||
|
resource-mapping = mkOption {
|
||||||
|
description = "Mapping of resources required by applications to available resources";
|
||||||
|
# TODO: type = ?
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
)
|
||||||
};
|
);
|
||||||
migration = submoduleWith {
|
|
||||||
description = "Migration of a Fediversity deployment to a Fediversity run-time environment";
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
deployment = mkOption {
|
|
||||||
description = "Deployment to migrate";
|
|
||||||
type = deployment;
|
|
||||||
};
|
|
||||||
runtime-environment = mkOption {
|
|
||||||
description = "Run-time environment to migrate the deployment to";
|
|
||||||
type = runtime-environment;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
providers = mkOption {
|
|
||||||
description = "Collection of providers for run-time environments to deploy applications to";
|
|
||||||
type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: provider));
|
|
||||||
};
|
|
||||||
resources = mkOption {
|
|
||||||
description = "Collection of resources for use in Fediversity applications";
|
|
||||||
type = attrsOf resource;
|
|
||||||
};
|
|
||||||
applications = mkOption {
|
|
||||||
description = "Collection of (available) Fediversity applications";
|
|
||||||
type = attrsOf application;
|
|
||||||
};
|
|
||||||
deployments = mkOption {
|
|
||||||
description = "Deployment of a configuration of applications to a run-time environment";
|
|
||||||
type = attrsOf deployment;
|
|
||||||
};
|
|
||||||
migrations = mkOption {
|
|
||||||
description = "Migrations from Fediversity deployments to Fediversity run-time environments";
|
|
||||||
type = attrsOf migration;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue