forked from fediversity/fediversity
WIP
This commit is contained in:
parent
c764c0f7b6
commit
1d7a18b0a6
1 changed files with 30 additions and 86 deletions
|
@ -20,101 +20,45 @@ let
|
||||||
submodule
|
submodule
|
||||||
str
|
str
|
||||||
;
|
;
|
||||||
provider = mkOption {
|
resource = submoduleWith {
|
||||||
description = "The NixOS module of a provider";
|
description = "A deployment resource that can be configured by providers and required by applications";
|
||||||
type = deferredModule;
|
|
||||||
default = {
|
|
||||||
_class = "nixos";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
runtime-environment = attrTag (
|
|
||||||
mapAttrs
|
|
||||||
(
|
|
||||||
name:
|
|
||||||
option@{ type, ... }:
|
|
||||||
mkOption (
|
|
||||||
option
|
|
||||||
// {
|
|
||||||
type = mergeTypes type (submodule {
|
|
||||||
options.module = mkOption {
|
|
||||||
description = "The NixOS module of the provider";
|
|
||||||
type = deferredModule;
|
|
||||||
default = config.providers.${name};
|
|
||||||
readOnly = true;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vm = {
|
|
||||||
description = "A VM to deploy to.";
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
single-ssh-host = {
|
|
||||||
description = "A single host to deploy to by SSH.";
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
ssh = mkOption {
|
|
||||||
description = "SSH connection info";
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
host = mkOption {
|
|
||||||
description = "the host to access by SSH";
|
|
||||||
type = str;
|
|
||||||
};
|
|
||||||
username = mkOption {
|
|
||||||
description = "the SSH user to use";
|
|
||||||
type = nullOr str;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
authentication = mkOption {
|
|
||||||
description = "authentication method";
|
|
||||||
type = attrsOf (attrTag {
|
|
||||||
private-key = mkOption {
|
|
||||||
description = "path to the user's SSH private key";
|
|
||||||
type = str;
|
|
||||||
example = "/root/.ssh/id_ed25519";
|
|
||||||
};
|
|
||||||
password = mkOption {
|
|
||||||
description = "SSH password";
|
|
||||||
# TODO: mark as sensitive
|
|
||||||
type = str;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
resource = attrTag {
|
|
||||||
runtime-environment = mkOption {
|
|
||||||
description = "A run-time environment one may deploy a NixOS configuration to.";
|
|
||||||
type = runtime-environment;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
application = submoduleWith {
|
|
||||||
description = "A Fediversity application";
|
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
module = mkOption {
|
consumer = mkOption {
|
||||||
description = ''
|
description = "Description how applications can consume the resource";
|
||||||
The NixOS module to configure the application.
|
type = deferredModule;
|
||||||
'';
|
};
|
||||||
|
provider = mkOption {
|
||||||
|
description = "Description how the hosting provider makes the resource available";
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
application = submoduleWith {
|
||||||
|
description = "A Fediversity application";
|
||||||
|
modules = [
|
||||||
|
(
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
module = mkOption {
|
||||||
|
description = ''
|
||||||
|
A module for configuring the application.
|
||||||
|
'';
|
||||||
|
type = deferredModule;
|
||||||
|
};
|
||||||
|
config-mapping = mkOption {
|
||||||
|
description = "description of how an application configuration maps to deployment resources";
|
||||||
|
# TODO: type = (submodule config.module) -> (attrsOf resource)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
};
|
||||||
deployment = submoduleWith {
|
deployment = submoduleWith {
|
||||||
description = "A deployment of a configuration of applications to a run-time environment";
|
description = "A deployment of a configuration of applications to a run-time environment";
|
||||||
modules = [
|
modules = [
|
||||||
|
|
Loading…
Add table
Reference in a new issue