forked from Fediversity/Fediversity
data model: deployment
This commit is contained in:
parent
f51462afc9
commit
6c2022d064
2 changed files with 56 additions and 23 deletions
|
@ -16,41 +16,50 @@ in
|
||||||
test-eval = {
|
test-eval = {
|
||||||
expr =
|
expr =
|
||||||
let
|
let
|
||||||
example = eval {
|
example = eval (
|
||||||
runtime-configurations.single-ssh-host =
|
{ config, ... }:
|
||||||
{ ... }:
|
{
|
||||||
{
|
runtime-configurations.single-ssh-host =
|
||||||
system.stateVersion = "25.05";
|
{ ... }:
|
||||||
};
|
|
||||||
runtime-environments.bar = {
|
|
||||||
single-ssh-host = {
|
|
||||||
ssh = {
|
|
||||||
host = "localhost";
|
|
||||||
username = "root";
|
|
||||||
authentication.password = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
applications.foo = {
|
|
||||||
module =
|
|
||||||
{ pkgs, ... }:
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = [
|
system.stateVersion = "25.05";
|
||||||
pkgs.hello
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
runtime-environments.bar = {
|
||||||
};
|
single-ssh-host = {
|
||||||
|
ssh = {
|
||||||
|
host = "localhost";
|
||||||
|
username = "root";
|
||||||
|
authentication.password = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
applications.foo = {
|
||||||
|
module =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.hello
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
deployments.baz = {
|
||||||
|
module = { };
|
||||||
|
runtime-environment = config.runtime-environments.bar;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
has-runtime-configuration = lib.isAttrs example.runtime-configurations.single-ssh-host;
|
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-runtime-environment = lib.isAttrs example.runtime-environments.bar.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;
|
||||||
};
|
};
|
||||||
expected = {
|
expected = {
|
||||||
has-runtime-configuration = true;
|
has-runtime-configuration = true;
|
||||||
has-runtime-environment = true;
|
has-runtime-environment = true;
|
||||||
has-application = true;
|
has-application = true;
|
||||||
|
has-deployment = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,26 @@ let
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
deployment = submoduleWith {
|
||||||
|
description = "A deployment of a configuration of applications to a run-time environment";
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
# the `applications` option consists of configuration for the above applications
|
||||||
|
module = mkOption {
|
||||||
|
description = ''
|
||||||
|
Configuration to be deployed
|
||||||
|
'';
|
||||||
|
type = deferredModule;
|
||||||
|
};
|
||||||
|
runtime-environment = mkOption {
|
||||||
|
description = "The run-time environment to deploy to";
|
||||||
|
type = runtime-environment;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
@ -122,5 +142,9 @@ in
|
||||||
description = "Collection of Fediversity applications";
|
description = "Collection of Fediversity applications";
|
||||||
type = attrsOf application;
|
type = attrsOf application;
|
||||||
};
|
};
|
||||||
|
deployments = mkOption {
|
||||||
|
description = "Deployment of a configuration of applications to a run-time environment";
|
||||||
|
type = attrsOf deployment;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue