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 (
|
example = eval (
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
runtime-configurations.single-ssh-host =
|
providers.single-ssh-host =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
system.stateVersion = "25.05";
|
system.stateVersion = "25.05";
|
||||||
};
|
};
|
||||||
runtime-environments.bar = {
|
resources.bar.runtime-environment.single-ssh-host = {
|
||||||
single-ssh-host = {
|
ssh = {
|
||||||
ssh = {
|
host = "localhost";
|
||||||
host = "localhost";
|
username = "root";
|
||||||
username = "root";
|
authentication.password = "";
|
||||||
authentication.password = "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
applications.foo = {
|
applications.foo.module =
|
||||||
module =
|
{ pkgs, ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
environment.systemPackages = [
|
||||||
environment.systemPackages = [
|
pkgs.hello
|
||||||
pkgs.hello
|
];
|
||||||
];
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
deployments.baz = {
|
deployments.baz = {
|
||||||
module = { };
|
module = { };
|
||||||
runtime-environment = config.runtime-environments.bar;
|
runtime-environment = config.resources.bar.runtime-environment;
|
||||||
};
|
};
|
||||||
migrations.boo = {
|
migrations.boo = {
|
||||||
deployment = config.deployments.baz;
|
deployment = config.deployments.baz;
|
||||||
runtime-environment = config.runtime-environments.bar;
|
runtime-environment = config.resources.bar.runtime-environment;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
has-runtime-configuration = lib.isAttrs example.runtime-configurations.single-ssh-host;
|
has-provider = lib.isAttrs example.providers.single-ssh-host;
|
||||||
has-runtime-environment = lib.isAttrs example.runtime-environments.bar.single-ssh-host.module;
|
has-resource = lib.isAttrs example.resources.bar.runtime-environment.single-ssh-host.module;
|
||||||
has-application = lib.isAttrs example.applications.foo.module;
|
has-application = lib.isAttrs example.applications.foo.module;
|
||||||
has-deployment = lib.isAttrs example.deployments.baz.module;
|
has-deployment = lib.isAttrs example.deployments.baz.module;
|
||||||
has-migration = lib.isAttrs example.migrations.boo.deployment;
|
has-migration = lib.isAttrs example.migrations.boo.deployment;
|
||||||
};
|
};
|
||||||
expected = {
|
expected = {
|
||||||
has-runtime-configuration = true;
|
has-provider = true;
|
||||||
has-runtime-environment = true;
|
has-resource = true;
|
||||||
has-application = true;
|
has-application = true;
|
||||||
has-deployment = true;
|
has-deployment = true;
|
||||||
has-migration = true;
|
has-migration = true;
|
||||||
|
|
|
@ -20,8 +20,8 @@ let
|
||||||
submodule
|
submodule
|
||||||
str
|
str
|
||||||
;
|
;
|
||||||
runtime-configuration = mkOption {
|
provider = mkOption {
|
||||||
description = "The NixOS module of a run-time environment";
|
description = "The NixOS module of a provider";
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
default = {
|
default = {
|
||||||
_class = "nixos";
|
_class = "nixos";
|
||||||
|
@ -37,9 +37,9 @@ let
|
||||||
// {
|
// {
|
||||||
type = mergeTypes type (submodule {
|
type = mergeTypes type (submodule {
|
||||||
options.module = mkOption {
|
options.module = mkOption {
|
||||||
description = "The NixOS module of the run-time environment";
|
description = "The NixOS module of the provider";
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
default = config.runtime-configurations.${name};
|
default = config.providers.${name};
|
||||||
readOnly = true;
|
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 {
|
application = submoduleWith {
|
||||||
description = "A Fediversity application";
|
description = "A Fediversity application";
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
module = mkOption {
|
module = mkOption {
|
||||||
description = "The NixOS module for that application, for configuring that application";
|
description = ''
|
||||||
|
The NixOS module to configure the application.
|
||||||
|
'';
|
||||||
type = deferredModule;
|
type = deferredModule;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -147,16 +155,16 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
runtime-configurations = mkOption {
|
providers = mkOption {
|
||||||
description = "Collection of runtime environments into which applications can be deployed";
|
description = "Collection of providers for run-time environments to deploy applications to";
|
||||||
type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: runtime-configuration));
|
type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: provider));
|
||||||
};
|
};
|
||||||
runtime-environments = mkOption {
|
resources = mkOption {
|
||||||
description = "Collection of runtime environments into which applications can be deployed";
|
description = "Collection of resources for use in Fediversity applications";
|
||||||
type = attrsOf runtime-environment;
|
type = attrsOf resource;
|
||||||
};
|
};
|
||||||
applications = mkOption {
|
applications = mkOption {
|
||||||
description = "Collection of Fediversity applications";
|
description = "Collection of (available) Fediversity applications";
|
||||||
type = attrsOf application;
|
type = attrsOf application;
|
||||||
};
|
};
|
||||||
deployments = mkOption {
|
deployments = mkOption {
|
||||||
|
|
Loading…
Add table
Reference in a new issue