forked from Fediversity/Fediversity
better reflect naming from diagram configuration data flow
This commit is contained in:
parent
34529a7de4
commit
c764c0f7b6
2 changed files with 39 additions and 35 deletions
|
@ -19,50 +19,46 @@ in
|
|||
example = eval (
|
||||
{ config, ... }:
|
||||
{
|
||||
runtime-configurations.single-ssh-host =
|
||||
providers.single-ssh-host =
|
||||
{ ... }:
|
||||
{
|
||||
system.stateVersion = "25.05";
|
||||
};
|
||||
runtime-environments.bar = {
|
||||
single-ssh-host = {
|
||||
ssh = {
|
||||
host = "localhost";
|
||||
username = "root";
|
||||
authentication.password = "";
|
||||
};
|
||||
resources.bar.runtime-environment.single-ssh-host = {
|
||||
ssh = {
|
||||
host = "localhost";
|
||||
username = "root";
|
||||
authentication.password = "";
|
||||
};
|
||||
};
|
||||
applications.foo = {
|
||||
module =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
pkgs.hello
|
||||
];
|
||||
};
|
||||
};
|
||||
applications.foo.module =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
pkgs.hello
|
||||
];
|
||||
};
|
||||
deployments.baz = {
|
||||
module = { };
|
||||
runtime-environment = config.runtime-environments.bar;
|
||||
runtime-environment = config.resources.bar.runtime-environment;
|
||||
};
|
||||
migrations.boo = {
|
||||
deployment = config.deployments.baz;
|
||||
runtime-environment = config.runtime-environments.bar;
|
||||
runtime-environment = config.resources.bar.runtime-environment;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
has-runtime-configuration = lib.isAttrs example.runtime-configurations.single-ssh-host;
|
||||
has-runtime-environment = lib.isAttrs example.runtime-environments.bar.single-ssh-host.module;
|
||||
has-provider = lib.isAttrs example.providers.single-ssh-host;
|
||||
has-resource = lib.isAttrs example.resources.bar.runtime-environment.single-ssh-host.module;
|
||||
has-application = lib.isAttrs example.applications.foo.module;
|
||||
has-deployment = lib.isAttrs example.deployments.baz.module;
|
||||
has-migration = lib.isAttrs example.migrations.boo.deployment;
|
||||
};
|
||||
expected = {
|
||||
has-runtime-configuration = true;
|
||||
has-runtime-environment = true;
|
||||
has-provider = true;
|
||||
has-resource = true;
|
||||
has-application = true;
|
||||
has-deployment = true;
|
||||
has-migration = true;
|
||||
|
|
|
@ -20,8 +20,8 @@ let
|
|||
submodule
|
||||
str
|
||||
;
|
||||
runtime-configuration = mkOption {
|
||||
description = "The NixOS module of a run-time environment";
|
||||
provider = mkOption {
|
||||
description = "The NixOS module of a provider";
|
||||
type = deferredModule;
|
||||
default = {
|
||||
_class = "nixos";
|
||||
|
@ -37,9 +37,9 @@ let
|
|||
// {
|
||||
type = mergeTypes type (submodule {
|
||||
options.module = mkOption {
|
||||
description = "The NixOS module of the run-time environment";
|
||||
description = "The NixOS module of the provider";
|
||||
type = deferredModule;
|
||||
default = config.runtime-configurations.${name};
|
||||
default = config.providers.${name};
|
||||
readOnly = true;
|
||||
};
|
||||
});
|
||||
|
@ -94,13 +94,21 @@ let
|
|||
};
|
||||
}
|
||||
);
|
||||
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 = [
|
||||
{
|
||||
options = {
|
||||
module = mkOption {
|
||||
description = "The NixOS module for that application, for configuring that application";
|
||||
description = ''
|
||||
The NixOS module to configure the application.
|
||||
'';
|
||||
type = deferredModule;
|
||||
};
|
||||
};
|
||||
|
@ -147,16 +155,16 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
runtime-configurations = mkOption {
|
||||
description = "Collection of runtime environments into which applications can be deployed";
|
||||
type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: runtime-configuration));
|
||||
providers = mkOption {
|
||||
description = "Collection of providers for run-time environments to deploy applications to";
|
||||
type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: provider));
|
||||
};
|
||||
runtime-environments = mkOption {
|
||||
description = "Collection of runtime environments into which applications can be deployed";
|
||||
type = attrsOf runtime-environment;
|
||||
resources = mkOption {
|
||||
description = "Collection of resources for use in Fediversity applications";
|
||||
type = attrsOf resource;
|
||||
};
|
||||
applications = mkOption {
|
||||
description = "Collection of Fediversity applications";
|
||||
description = "Collection of (available) Fediversity applications";
|
||||
type = attrsOf application;
|
||||
};
|
||||
deployments = mkOption {
|
||||
|
|
Loading…
Add table
Reference in a new issue